going_live thread: Netscape 7/Mozilla - SelectedIndex will not populate select text
Which version of Javascript are you using as the selectedIndex property is
read only in Javascript 1.0, do you have a sample page with the rest of the
code on ? are you sure that it is just that line that is failing ? Are you
sure that the CreateElement calls run on NN ?
At 00:32 21/11/02 +0000, you wrote:
>You will find the code below. The only problem is that with Netscape 7,
>using the line "listObject.selectedIndex = 0" will not update the
>selectbox text.
>
>Thanks for any suggestions. Mike
>----------------------------------------
>
>//Use method on other frame to create option, returns a reference
>var oOption = parent.parent.metaedit_nav.document.createElement("OPTION");
>
>//add option to select box in other frame
>listObject.options[listObject.options.length] = oOption;
>
>//resort the select list so most current is at top of list
>for (x=listObject.options.length-1; x>0 ;x--){
>
> listObject.options[x].value = listObject.options[x-1].value;
> listObject.options[x].text = listObject.options[x-1].text;
>
>
>}
>
>//Add new URL
>listObject.options[0].value = frm_metaedit_source.location.href;
>listObject.options[0].text = frm_metaedit_source.location.href.substr(24);
>listObject.selectedIndex = 0;
>
>
>
> > Netscape requires you to do the entire thing properly without the IE
>shortcuts, if you post the code I should be able to assist.
>
>At 23:18 20/11/02 +0000, you wrote:
> >I've written code that will automate the selection of an item in a select
> >drop down list. Using JavaScript, I am accessing a select box in another
> >frame. I select the desried list item by using the following code:
> >
> > listObject.selectedIndex = 0;
> >
> >In IE 5+ and Netscape 4.7 this works correctly (Item 0 is selected AND the
> >text in the select box is populated).
> >
> >With Netscape 7/Mozilla the correct item is selected, but the text box is
> >not populated with the text.
> >
> >Thanks in advance for any suggestions you may have.
>
>
>