求js专家看一下,为什么这段代码不能alert()
<SCRIPTlanguage=javascript>functionCheck(){if(form.name.value==""){alert("用户名不能为空");f...
<SCRIPT language=javascript>
function Check()
{
if (form.name.value=="")
{
alert("用户名不能为空");
form.name.focus();
return false;
}
if (form.pwd.value=="")
{
alert("密码不能为空");
form.pwd.focus();
return false;
}
}
</SCRIPT>
</head>
<body>
<form name="form" method="post" action="index_ok.php" onsubmit="return check();">
<table id="__01" width="761" height="559" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3">
<img src="images/index_01.jpg" width="761" height="119" alt=""></td>
</tr>
<tr>
<td>
<img src="images/log_02.jpg" width="133" height="365" alt=""></td>
<td width="383" height="365" align="center"><p><span class="STYLE2">用户名:</span>
<input name="name" type="text" id="name" size="20">
<span class="STYLE2"> </p>
<p>密 码:
<input name="pwd" type="password" id="pwd" size="20">
</p>
<p>
<input type="submit" name="Submit" value="提交">
<input type="reset" name="Submit2" value="重置">
</p>
</td>
<td>
<img src="images/log_04.jpg" width="245" height="365" alt=""></td>
</tr>
<tr>
<td colspan="3">
<img src="images/index_05.jpg" width="761" height="75" alt=""></td>
</tr>
</table>
</form> 展开
function Check()
{
if (form.name.value=="")
{
alert("用户名不能为空");
form.name.focus();
return false;
}
if (form.pwd.value=="")
{
alert("密码不能为空");
form.pwd.focus();
return false;
}
}
</SCRIPT>
</head>
<body>
<form name="form" method="post" action="index_ok.php" onsubmit="return check();">
<table id="__01" width="761" height="559" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3">
<img src="images/index_01.jpg" width="761" height="119" alt=""></td>
</tr>
<tr>
<td>
<img src="images/log_02.jpg" width="133" height="365" alt=""></td>
<td width="383" height="365" align="center"><p><span class="STYLE2">用户名:</span>
<input name="name" type="text" id="name" size="20">
<span class="STYLE2"> </p>
<p>密 码:
<input name="pwd" type="password" id="pwd" size="20">
</p>
<p>
<input type="submit" name="Submit" value="提交">
<input type="reset" name="Submit2" value="重置">
</p>
</td>
<td>
<img src="images/log_04.jpg" width="245" height="365" alt=""></td>
</tr>
<tr>
<td colspan="3">
<img src="images/index_05.jpg" width="761" height="75" alt=""></td>
</tr>
</table>
</form> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询