javascript 表单提交
来源:互联网 发布:什么是黑箱 人工智能 编辑:程序博客网 时间:2024/05/29 16:28
<script type="text/javascript">
function saveCheck()
{
if(document.form.staid.value==""||document.form.staid.value==null)
{
alert("员工编号不能为空!");
document.form.staid.value="";
document.form.staid.focus();
return false;
}
if(document.form.staname.value==""||document.form.staname.value==null)
{
alert("姓名不能为空!");
document.form.staname.value="";
document.form.staname.focus();
return false;
}
if(document.form.stasex.value==""||document.form.stasex.value==null)
{
alert("姓别不能为空!");
document.form.stasex.value="";
document.form.stasex.focus();
return false;
}
if(document.form.staage.value==""||document.form.staage.value==null )
{
alert("年龄不能为空!");
document.form.staage.value="";
document.form.staage.focus();
return false;
}
/* if(document.form.stamobilephone.value==""||document.form.stamobilephone.value==null&&document.form.stamobilephone.value=="/^1[3|4|5|8][0-9]\d{4,8}$/")
{
alert("手机号不能为空!");
document.form.stamobilephone.value="";
document.form.stamobilephone.focus();
return false;
}*/
var objValue=stamobilephone.value;
if(objValue == null || objValue == ''){
return true;
}
var reg=/^1[3|4|5|8][0-9]\d{4,8}$/;
if(!reg.test(objValue)){
alert("不是完整的11位手机号码!");
stamobilephone.focus();
return false;
}
/* var reg=/^1[3|4|5|8][0-9]\d{4,8}$/;
if(!reg.test(stamobilephone))
{
alert("不是完整的11位手机号码!");
stamobilephone.focus();
return false;
}*/
if(document.form.staemail.value==""||document.form.staemail.value==null )
{
alert("邮箱不能为空!");
document.form.staemail.value="";
document.form.staemail.focus();
return false;
}
if(document.form.staqq.value==""||document.form.staqq.value==null )
{
alert("QQ不能为空!");
document.form.staqq.value="";
document.form.staqq.focus();
return false;
}
if(document.form.staaddress.value==""||document.form.staaddress.value==null )
{
alert("地址不能为空!");
document.form.staaddress.value="";
document.form.staaddress.focus();
return false;
}
/* var code=(document.getElementById("staid"));
if(code.value==null)
{
alert("员工编号不能为空!");
return false;
}
else
{
if(deleteNull(code)=='')
{
alert("员工编号不能为空!");
return false;
}
}
var addresse=(document.getElementById("staaddress"));
if(name.value==null)
{
alert("地址不能为空!");
return false;
}
else
{
if(deleteNull(address)=='')
{
alert("地址不能为空!");
return false;
}
}*/
}
</script>
</head>
<body>
<form action="index.jsp" method="post" name="form" onsubmit="return saveCheck()">
<h2 align="center"> 员工信息添加</h2>
<table align="center">
<tr>
<td>编号:</td>
<td><input type="text" name="staid" id="staid"/></td>
</tr>
<tr>
<td>姓名:</td>
<td><input type="text" name="staname" id="staname"/></td>
</tr>
<tr>
<td>性别:</td>
<td><input type="text" name="stasex" id="stasex"/></td>
</tr>
<tr>
<td>年龄:</td>
<td><input type="text" name="staage" id="staage"/></td>
</tr>
<tr>
<td>手机:</td>
<td><input type="text" name="stamobilephone" id="stamobilephone"/></td>
</tr>
<tr>
<td>邮箱:</td>
<td><input type="text" name="staemail" id="staemail"/></td>
</tr>
<tr>
<td>Q Q:</td>
<td><input type="text" name="staqq" id="staqq"/></td>
</tr>
<tr>
<td>地址:</td>
<td><input type="text" name="staaddress" id="staaddress"/></td>
</tr>
<tr>
<td>
<input type="submit" value="提交" />
</td>
<td><input type="reset" value="重置"/>
</td>
</tr>
</table>
</form>
</body>
</html>
- javascript表单提交
- JavaScript表单提交
- javascript:回车提交表单
- JavaScript提交表单
- javascript阻止表单提交
- javascript 终止表单提交
- 用JAVASCRIPT提交表单
- javascript提交表单
- JavaScript提交表单数组
- javascript 终止表单提交
- javascript回车提交表单
- javascript 表单提交
- JavaScript阻止表单提交
- javascript控制表单提交
- javascript 阻止表单提交
- javascript 回车提交表单!
- javascript提交form表单
- javaScript表单提交验证
- Linux 网络操作命令
- 数据库连接池 dbcp与c3p0的使用
- 需求+个性推荐+聚合思维 会是个啥呢?
- 通过webservice使用jquery访问数据(包含显示,验证,修改)
- shell函数--函数调用
- javascript 表单提交
- slab/slob/slub的区别
- 嵌入式入门建议(很多工程师共同交流的心得)
- 如何让上司赏识你,做到这七点就可以了
- 从binlog恢复数据及Mysqlbinlog文件删除
- Jquery DataTables自学笔记 之 自定义布局
- 本地通知
- 系统工作期间调整/home分区
- renren app (3) 显示用户个人信息