javascript代码求助!为什么这个代码不执行!
<html><head><title>我的爱好</title><scripttype="text/javascript">functioncheck(){varage=d...
<html> <head><title>我的爱好</title>
<script type="text/javascript">
function check(){
var age=document.getElementsByName("nianling").value;
if(age < 18){
alert("小朋友,你尚未成年不能进入本站");
}}</script>
</head>
<body> <form action="" method="post">
<table width="800" border="1" height=500 >
<caption>我的爱好</caption>
<tr>
<td align=center>姓名:</td> <td>
<input type="text" name="xingming"></td> </tr>
<tr>
<td align=center>密码:</td> <td>
<input type="text" name="mima"></td> </tr>
<tr>
<td align=center>年龄:</td> <td>
<input type="text" name="nianling" ></td> </tr>
<tr><td width=100% colspan="2" align=center><input type="submit" value="提交" onclick="check()"> <input type="reset" value="重置">
</td></tr>
</td> </tr>
</table>
</form>
</body>
</html> 展开
<script type="text/javascript">
function check(){
var age=document.getElementsByName("nianling").value;
if(age < 18){
alert("小朋友,你尚未成年不能进入本站");
}}</script>
</head>
<body> <form action="" method="post">
<table width="800" border="1" height=500 >
<caption>我的爱好</caption>
<tr>
<td align=center>姓名:</td> <td>
<input type="text" name="xingming"></td> </tr>
<tr>
<td align=center>密码:</td> <td>
<input type="text" name="mima"></td> </tr>
<tr>
<td align=center>年龄:</td> <td>
<input type="text" name="nianling" ></td> </tr>
<tr><td width=100% colspan="2" align=center><input type="submit" value="提交" onclick="check()"> <input type="reset" value="重置">
</td></tr>
</td> </tr>
</table>
</form>
</body>
</html> 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询