The following code snippet works in IE, but not Firefox The parts that access text boxes work great. I can see the selectedIndex's value for the two drop-downs, but cannot retrieve the text of the selected item for either drop-down. Specifically, the first alert displays the value of the URL string to that point. The second alert doesn't display.

I would really appreciate any help with this one!

var URL = "" +;
URL += "&title=" + document.data_entry.media_title.value;
URL += "&URL=" + document.data_entry.URL.value;

URL += "&topic=" + document.data_entry.topic.options(document.data_entry.topic.selectedIndex).text;
URL += "&format=" + document.data_entry.format.options(document.data_entry.format.selectedIndex).text ;

Read this.

As far as your problem is concerned, document.data_entry.topic.options(document.data_entry.topic.selectedIndex).text; should be document.data_entry.topic.options[document.data_entry.topic.selectedIndex].value ;

The above way of referencing form elements is pretty inefficient and partly incorrect which is what the tutorial I posted aims at explaining.

Thanks for your excellent tutorial on accessing the elements of a form! Thanks also for pointing out my referencing error.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.