网页中的按钮为什么不触发onclick事件
如下代码所示:为什么我单击添加按钮,不触发onclick="returnMycheck()"这个事件呢?请大侠们帮帮忙,谢谢了!<htmlxmlns="http://ww...
如下代码所示:为什么我单击添加按钮,不触发onclick="return Mycheck()"这个事件呢?请大侠们帮帮忙,谢谢了!
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script language="javascript" type="text/javascript">
<!--
function Mycheck(){
if(document.Useradd.username.value==""){
alert('请输入管理员名称!');return false;}
if(document.Useradd.password.value==""){
alert('请输入密码!');return false;}
if(document.Useradd.password2.value<>document.Useradd.password.value){
alert('两次输入密码不一致!');return false;
}
}
-->
</script>
</head>
<body>
<form action="" method="post" name="Useradd">
<table width="101%" border="0" cellspacing="1" cellpadding="2">
<tr class="Title">
<td colspan="2"><div align="center"><strong>新 增 用 户</strong></div></td>
</tr>
<tr class="tdbg">
<td width="12%" align="right"><strong>用户名:</strong></td>
<td><label>
<input name="username" type="text" id="username" size="20" maxlength="16" />
</label></td>
</tr>
<tr class="tdbg">
<td width="12%" align="right"><strong>用户密码:</strong></td>
<td><label>
<input name="password" type="password" id="password" size="20" maxlength="20" />
</label></td>
</tr>
<tr class="tdbg">
<td align="right"><strong>确认密码:</strong></td>
<td><label>
<input name="password2" type="password" id="password2" size="20" maxlength="16" />
</label></td>
</tr>
<tr class="tdbg">
<td align="right"><strong>用户身份:</strong></td>
<td><label>
<select name="identity" id="identity">
<option>管理员</option>
<option>操作员</option>
</select>
</label></td>
</tr>
<tr class="tdbg">
<td> </td>
<td height="40"><label>
<input type="submit" name="add" id="add" onclick="return Mycheck()" value="添 加" />
</label> <input id="Cancel" style="CURSOR: hand" onclick="window.location.href='Admin_add.asp';" type="button" value=" 取 消 " name="Cancel" /> </td>
</tr>
</table>
</form>
</body>
</html> 展开
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script language="javascript" type="text/javascript">
<!--
function Mycheck(){
if(document.Useradd.username.value==""){
alert('请输入管理员名称!');return false;}
if(document.Useradd.password.value==""){
alert('请输入密码!');return false;}
if(document.Useradd.password2.value<>document.Useradd.password.value){
alert('两次输入密码不一致!');return false;
}
}
-->
</script>
</head>
<body>
<form action="" method="post" name="Useradd">
<table width="101%" border="0" cellspacing="1" cellpadding="2">
<tr class="Title">
<td colspan="2"><div align="center"><strong>新 增 用 户</strong></div></td>
</tr>
<tr class="tdbg">
<td width="12%" align="right"><strong>用户名:</strong></td>
<td><label>
<input name="username" type="text" id="username" size="20" maxlength="16" />
</label></td>
</tr>
<tr class="tdbg">
<td width="12%" align="right"><strong>用户密码:</strong></td>
<td><label>
<input name="password" type="password" id="password" size="20" maxlength="20" />
</label></td>
</tr>
<tr class="tdbg">
<td align="right"><strong>确认密码:</strong></td>
<td><label>
<input name="password2" type="password" id="password2" size="20" maxlength="16" />
</label></td>
</tr>
<tr class="tdbg">
<td align="right"><strong>用户身份:</strong></td>
<td><label>
<select name="identity" id="identity">
<option>管理员</option>
<option>操作员</option>
</select>
</label></td>
</tr>
<tr class="tdbg">
<td> </td>
<td height="40"><label>
<input type="submit" name="add" id="add" onclick="return Mycheck()" value="添 加" />
</label> <input id="Cancel" style="CURSOR: hand" onclick="window.location.href='Admin_add.asp';" type="button" value=" 取 消 " name="Cancel" /> </td>
</tr>
</table>
</form>
</body>
</html> 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询