为什么我点击提交按钮没有反应呢?我已经将行为面板里的onSubmit 后填写了 return checkFormDate()了。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="/style/style.css" rel="stylesheet" type="text/css" />
<script language="javascript">
function checkFormDate(){
if(form1.txtUsername.value==" "){
alert("用户名不能为空");
form1.txtUsername.focus();
return false;
}
if(form1.txtPassword.value==" "){
alert("密码不能为空");
form1.txtPassword.focus();
return false;
}
if(form1.txtRePassword.value==" "){
alert("请再次输入密码");
form1.txtRePassword.focus();
return false;
}
if(form1.txtBirthdate.value==" "){
alert("出生日期不能为空");
form1.txtBirthdate.focus();
return false;
}
}
</script>
</head>
<body>
<?php require_once("menu.php");?>
<div class="style1">
<table>
<th>注册新会员</th>
</table>
<form method="post" name="form1" onsubmit="return checkFormDate();" align="center">
用户名:<input type="text" name="txtUsername" /><br />
性别:<input type="radio" name="sex" value="man" checked="checked"/>男
<input type="radio" name="sex" value"wonmen" />女<br />
密码:<input type="text" name="txtPassword"/><br />
确认密码:<input type="text" name="txtRePassword"/><br />
出生日期:<input type="text" name="txtBirthdate"/><br />
安全问题:<input type="text" /><br />
答案:<input type="text" /><br />
电子信箱:<input type="text" /><br />
自我介绍:<textarea rows="3" ></textarea><br />
<input name="submit" type="submit" value="提交" />
<input name="reset" type="reset" value="重置" />
</form>
</div>
</body></html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="/style/style.css" rel="stylesheet" type="text/css" />
<script language="javascript">
function checkFormDate(){
if(form1.txtUsername.value==" "){
alert("用户名不能为空");
form1.txtUsername.focus();
return false;
}
if(form1.txtPassword.value==" "){
alert("密码不能为空");
form1.txtPassword.focus();
return false;
}
if(form1.txtRePassword.value==" "){
alert("请再次输入密码");
form1.txtRePassword.focus();
return false;
}
if(form1.txtBirthdate.value==" "){
alert("出生日期不能为空");
form1.txtBirthdate.focus();
return false;
}
}
</script>
</head>
<body>
<?php require_once("menu.php");?>
<div class="style1">
<table>
<th>注册新会员</th>
</table>
<form method="post" name="form1" onsubmit="return checkFormDate();" align="center">
用户名:<input type="text" name="txtUsername" /><br />
性别:<input type="radio" name="sex" value="man" checked="checked"/>男
<input type="radio" name="sex" value"wonmen" />女<br />
密码:<input type="text" name="txtPassword"/><br />
确认密码:<input type="text" name="txtRePassword"/><br />
出生日期:<input type="text" name="txtBirthdate"/><br />
安全问题:<input type="text" /><br />
答案:<input type="text" /><br />
电子信箱:<input type="text" /><br />
自我介绍:<textarea rows="3" ></textarea><br />
<input name="submit" type="submit" value="提交" />
<input name="reset" type="reset" value="重置" />
</form>
</div>
</body></html>
解决方案 »
- span隐藏后再次显示,位置变了…
- JS中的scroll client offset等定位属性!
- 不熟悉jquery,麻烦高手帮助完善一个函数
- 如何实现在打开一个网页后定时弹出指定的网页?
- 求教一个document.write换行问题
- @@@最后20分了。我想在一个<a>右键事件,弹出一个菜单。菜单只要1级的。·······
- showmodledialog加codethat的tree的用法疑难??
- 想实现基于xml的树形菜单,一定要在ie和netscape上都正常运行的
- 求!!梅花雨大哥的 Web Calendar ver 3.0 网页日历!! 哪位大大有啊 急!!!!!!!!!!
- 请问:有什么办法图片上的某个区域显示一个字符?
- 路由器WEB管理的登录对话框实现
- 请问这是什么语言谢的网页
function checkFormDate(){
if(document.form1.txtUsername.value==""){
alert("用户名不能为空");
document.form1.txtUsername.focus();
return false;
}
if(document.form1.txtPassword.value==""){
alert("密码不能为空");
document.form1.txtPassword.focus();
return false;
}
if(document.form1.txtRePassword.value==""){
alert("请再次输入密码");
document.form1.txtRePassword.focus();
return false;
}
if(document.form1.txtBirthdate.value==""){
alert("出生日期不能为空");
document.form1.txtBirthdate.focus();
return false;
}}