|
发表于 2020-4-11 20:30:01
|
显示全部楼层
<Script language="javascript">
function query() {
alert(form1.select.options[form1.select.selectedIndex].text);
if(form1.select.options[form1.select.selectedIndex].text=="计算机"){
return form1.select.options[form1.select.selectedIndex].text;
}else if(form1.select.options[form1.select.selectedIndex].text=="机械系"){
return form1.select.options[form1.select.selectedIndex].text;
}else if(form1.select.options[form1.select.selectedIndex].text=="电子系"){
return form1.select.options[form1.select.selectedIndex].text;
}else if(form1.select.options[form1.select.selectedIndex].text=="数学系"){
return form1.select.options[form1.select.selectedIndex].text;
}
}
</script>
<form name="form1">
<select name="select">
<option value="0">请选择</option>
<option>机械系</option>
<option>电子系</option>
<option>数学系</option>
<option>计算机</option>
</select>
<input type="button" value="确定" onclick="query()">
</form> |
|