<html>
<script language="javascript">
function compare()
{
var a=document.all.list1.options[document.all.list1.selectedIndex].value
var b=document.all.list2.options[document.all.list2.selectedIndex].value
if(a==""&&b=="")
{
alert("您还没有选择")
}
else if(a==b)
{
alert("选择相同");
}
else alert("选择不同")
}
</script>
<body>
<table>
<tr><td>
<select name="list1" >
<option selected value="">请选择
<option value="a">a
<option value="b">b
<option value="c">c
<option value="d">d
</select>
</td><td>选项1</td></tr>
<tr><td>
<select name="list2" >
<option selected value="">请选择
<option value= "a">a
<option value="b">b
<option value="c">c
<option value="d">d
</select>
</td><td>选项2</td></tr> <br>
</table>
<input type="button" value="比较" onclick="compare();">
</body>
<html>
[此贴子已经被作者于2006-5-30 11:55:45编辑过]