<html>
<head>
<title></title>
<script type="text/javascript">
function checkForm(){
var name=document.form1.number.value; //or form1.number.value
var name=document.forms[0].number.value;
var name=document.forms[0]['number'].value;
var name=document.form1['number'].value //or form1['number'].value
alert(name);
}
</script>
</head>
<body>
<form name="form1" method="post" action="">
网元名称:<input type="text" name="number" size="20">
<br>
<input type="submit" value="提交" onClick="checkForm()">
</form>
</body>
</html>
获取form表单元素值的4种方式
最新推荐文章于 2024-09-12 10:06:54 发布