Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


pwaddles

113 posts

Master Geek


#34958 1-Jun-2009 20:22
Send private message

Hi guys,


I've got an issue with a piece of Javascript that seems to work fine on IE, Opera and Google Chrome but wont work on firefox which alot of people seem to be using.   The code is like this


document.all.FrameTypeValue.value = document.all.FrameType.value + "," + document.form1.FrameType.options[document.form1.FrameType.selectedIndex].text;


FrameTypeValue is a hidden field.


FrameType is a drop down box.


 


so Im trying to save to the FrameTypeValue field the value of the FrameType ddbox as well at the displayed text seperated by a comma.  Its for an order form, where the value means something to us and the text means something to the customer.  We use the info to create import files for our internal lab software.


 


Any help would be appreciated.


 





--------------------------------
Core 2 Duo e6850 3Ghz
4 X 1Gb DDR2 @ 800Mhz
GeForce 8800 GT 512Mb
P35 DS3L Mobo

Create new topic
Ragnor
8279 posts

Uber Geek
+1 received by user: 585

Trusted

  #220572 1-Jun-2009 20:55
Send private message

document.all() is a non-standard way of accessing DOM elements. It was originally started by IE. Not all browsers will support it, especially modern/new versions etc.

"getElementById" is the standard way of getting a DOM element by ID, eg: document.getElementById("FrameTypeValue").value =  etc






pwaddles

113 posts

Master Geek


  #220578 1-Jun-2009 21:00
Send private message

mate your a legend, I ended up using document.form1.FrameTypeValue etc... and it worked a treat, I would never of thought of document.all not being an available piece of code to use!! Thanks a million!!





--------------------------------
Core 2 Duo e6850 3Ghz
4 X 1Gb DDR2 @ 800Mhz
GeForce 8800 GT 512Mb
P35 DS3L Mobo

Ragnor
8279 posts

Uber Geek
+1 received by user: 585

Trusted

  #220579 1-Jun-2009 21:03
Send private message

Have a look at the jQuery library, it takes a lot of the pain out of writing cross browser javascript

http://jquery.com/


Create new topic








Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.