Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Select Box and Netscape Communicator

Status
Not open for further replies.

nomis

Programmer
May 8, 2000
1
SG
Hi,<br>i'm currently stuck. i got this piece of code that works in IE but not in Netscape Communicator 4.7. The program is suppose to update the 2nd list box with the 1st value of the 1st list box... anyone knows what the problem is.. thanks in advance....<br><br>1st select box name - &quot;snbr&quot;<br>2nd select box name - &quot;shtmfile&quot; <br><br>//this function inits the 2nd select box<br>function init(finit)<br>{<br>//if condition is true to carry out update of the 2nd select box<br>if (finit != 0)<br>{<br>&nbsp;&nbsp;var firstSnbr;//stores hardcoded value of the 1st select box<br>&nbsp;&nbsp;firstSnbr = document.form1.snbr[0].value;<br><br>&nbsp;&nbsp;htmArray = new Array;//stores the new options created<br><br>&nbsp;&nbsp;//code in &quot;case&quot; is generated by ASP leaving some empty<br>&nbsp;&nbsp;switch(firstSnbr)<br>&nbsp;&nbsp;{<br> case &quot;school&quot; :<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case &quot;me&quot; :<br> break;<br><br> case &quot;computer&quot; :<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;htmArray[0] = new Option (&quot;FileObject.htm&quot;, &quot;FileObject.htm&quot;);<br> htmArray[1] = new Option(&quot;FilesObject.htm&quot;, &quot;FilesObject.htm&quot;);<br> htmArray[2] = new Option(&quot;FormObject.htm&quot;, &quot;FormObject.htm&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;htmArray[3] = new Option(&quot;index.htm&quot;, &quot;index.htm&quot;); break;<br><br> case &quot;fashion&quot; :<br> htmArray[0] = new Option(&quot;FormObject.htm&quot;, &quot;FormObject.htm&quot;);<br> htmArray[1] = new Option(&quot;ItemObject.htm&quot;, &quot;ItemObject.htm&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br>&nbsp;&nbsp;&nbsp;&nbsp;}//switch<br> <br> //write values to the 2nd select box<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (x = 0; x &lt; htmArray.length; x++)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.form1.shtmfile[x] = htmArray[x]; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;<br> }//if<br>}//end of function<br>&lt;/script&gt;<br><br>the code that invoke it<br>&lt;body onload=&quot;init(&lt;%=i%&gt;);&quot;&gt;<br><br>&lt;!-- that's all --&gt;<br>&lt;!-- thanks folks --&gt;
 
Try changing this<br><br>firstSnbr = document.form1.snbr[0].value;<br><br>to<br><br>firstSnbr = document.form1.snbr.options[0].value; <p>nick bulka<br><a href=mailto:nick@bulka.com>nick@bulka.com</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top