joey o.
Oct 29th, 2000, 05:15 PM
Monte96 gave this really cool example but when I try to put in form tags it tells me "selTest" is undefined. Any cures? I tried appending "Form." with out success it only told me form was undefined.I want the form tags so I can use existing forms and templets that do submits.
code:
<HTML>
<HEAD>
<TITLE>test.htm</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
function selTest_onchange(){
var intloop;
var myvalue = selTest.options(selTest.selectedIndex).value;
for(intloop=1; intloop < selTest2.options.length; intloop++){
if (selTest2.options(intloop).value == myvalue) selTest2.options(intloop).selected=true;
}
}
-->
</SCRIPT>
</HEAD>
<BODY>
<Form>
<SELECT onchange="selTest_onchange()" ID="selTest" NAME="selTest">
<OPTION VALUE="1">One
<OPTION VALUE="2">Two
<OPTION VALUE="3">Three
<OPTION VALUE="4">Four
<OPTION VALUE="5">Five
</SELECT>
<SELECT ID="selTest2" NAME="selTest2">
<OPTION VALUE="1">A
<OPTION VALUE="2">B
<OPTION VALUE="3">C
<OPTION VALUE="4">D
<OPTION VALUE="5">E
</SELECT>
</Form>
</BODY>
</HTML>
code:
<HTML>
<HEAD>
<TITLE>test.htm</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
function selTest_onchange(){
var intloop;
var myvalue = selTest.options(selTest.selectedIndex).value;
for(intloop=1; intloop < selTest2.options.length; intloop++){
if (selTest2.options(intloop).value == myvalue) selTest2.options(intloop).selected=true;
}
}
-->
</SCRIPT>
</HEAD>
<BODY>
<Form>
<SELECT onchange="selTest_onchange()" ID="selTest" NAME="selTest">
<OPTION VALUE="1">One
<OPTION VALUE="2">Two
<OPTION VALUE="3">Three
<OPTION VALUE="4">Four
<OPTION VALUE="5">Five
</SELECT>
<SELECT ID="selTest2" NAME="selTest2">
<OPTION VALUE="1">A
<OPTION VALUE="2">B
<OPTION VALUE="3">C
<OPTION VALUE="4">D
<OPTION VALUE="5">E
</SELECT>
</Form>
</BODY>
</HTML>