<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>下拉菜单</title>
<script type="text/javascript">
function getindex(){
var x=document.getElementById("myselect")
alert(x.selectedIndex+1)
}
</script>
</head>
<body>
<form>
选择自己喜欢的演员:
<select id="myselect">
<option>魏无羡</option>
<option>蓝湛</option>
<option>大哥</option>
<option>三不知</option>
</select>
<br>
<br>
<input type="button" onclick="getindex()" value="提交">
</form>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>表单对象常用方法</title>
<script type="text/javascript">
function formsubmit(){
document.getElementById("myform").submit()
}
</script>
</head>
<body>
<form id="myform" action="1.jsp" method="get">
姓名:<input type="text" name="name" size="20"/><br>
住址:<input type="text" name="address" size="20">
<br>
<input type="button" onclick="formsubmit()" value="提交">
</form>
</body>
</html>