You are here: irt.org | FAQ | JavaScript | Form | 6 | Q761 [ previous next ]
Try:
<SCRIPT LANGUAGE="JavaScript"><!-- function test(what) { if (what.select1.options[what.select1.selectedIndex].value == what.select2.options[what.select2.selectedIndex].value) alert('They are the same'); } --></SCRIPT> <FORM NAME="myForm"> <SELECT NAME="select1"> <OPTION VALUE="abc">123 <OPTION VALUE="def">456 <OPTION VALUE="ghi">789 </SELECT> <SELECT NAME="select2"> <OPTION VALUE="abc">123 <OPTION VALUE="def">456 <OPTION VALUE="ghi">789 </SELECT> <INPUT TYPE="BUTTON" VALUE="SUBMIT" onClick="test(this.form)"> </FORM>