Forum Moderators: open

Message Too Old, No Replies

Netscape 4.x returning 'null' on Select list. Why?

         

MacromediaProd

4:48 pm on Oct 29, 2002 (gmt 0)

10+ Year Member



Does anyone know why this would return the value in IE, but not in Netscape 4.x? Netscape returns 'null' no matter what item is selected. Here is the code:

<script language="JavaScript">
<!--
function field(foo) {
document.form8.test.value=foo;
}
-->
</script>

<form name="form8">
<p>
<select name="skills1" onChange="field(this.value)">
<OPTION VALUE="">---Select a Skill ---</OPTION>
<OPTION VALUE=3270>3270
<OPTION VALUE=6K>6K
<OPTION VALUE=ADO>ADO
<OPTION VALUE=ADS>ADS
<OPTION VALUE=AMI>AMI
<OPTION VALUE=APPC - development>APPC - development
<OPTION VALUE=APPC- integration>APPC- integration
</select>
<input type="text" name="test">
</p>
<p>&nbsp; </p>
</form>

tedster

6:23 pm on Oct 29, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld.

Here's one problem - there's no </OPTION> tag in your code, except for the first value.

Whenever HTML isn't working the first resort is to the W3C's HTML validator at [validator.w3.org...]

The W3C also has a CSS validator at [jigsaw.w3.org...]

[edited by: tedster at 6:27 pm (utc) on Oct. 29, 2002]

MacromediaProd

6:26 pm on Oct 29, 2002 (gmt 0)

10+ Year Member



Thank you, but it returns NULL even with an </option> tag in place after each item.

korkus2000

7:21 pm on Oct 29, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld,

I don't think NN will take this.value for a drop down, but I could be wrong. Try using the older syntax.
<script language="JavaScript">
<!--
function field() {
document.form8.test.value=document.form8.skills1[document.form8.skills1.selectedIndex].value;
}
-->
</script>

g1smd

7:24 pm on Oct 29, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You also need to put the attribute value in Quotes; like VALUE="bar".

MacromediaProd

8:29 pm on Oct 29, 2002 (gmt 0)

10+ Year Member



Thanks so much for your help! That did the trick!