js 的 提交
2024-09-12 01:50:47
<script type="text/javascript">
function sub(){
if(document.form1.xingming.value=="") {
alert("姓名不能为空!");
form1.xingming.focus();
return false;
}
if(document.form1.mail.value=="") {
alert("请输入邮箱");
form1.mail.focus();
return false;
}
else{
var reg = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
if(!reg.test(document.form1.mail.value)){
alert("邮箱格式不正确!");
form1.mail.focus();
return false;
}
}
if(document.form1.liuyan.value=="") {
alert("请输入留言标题");
form1.liuyan.focus();
return false;
}
if(document.form1.neirong.value=="") {
alert("请输入留言内容");
form1.neirong.focus();
return false;
} document.form1.action="/跳转地址";
document.form1.submit();
} </script>
以上是js代码
以下是界面
<div class="letterMain">
<form action="/zykj_tl/wyzx.zykj" method="post" name="form1" id="form1">
<table class="letterMainTable">
<tr>
<td width="90" height="40" align="center" bgcolor="f3f3f3">姓 名:</td>
<td height="40" width="269" align="left"><input type="text" name="xingming" id="xingming" maxlength="10"/><span class="redFont" style="position:relative;*top:-4px;">*</span></td>
<td width="90" height="40" align="center" bgcolor="f3f3f3">E-mail:</td>
<td height="40" align="left"><input type="text" name="mail" id="mail" maxlength="40"/></td>
</tr>
<tr>
<td height="40" align="center" bgcolor="f3f3f3">地址:</td>
<td height="40" align="left"><input type="text" name="dizhi" id="dizhi" maxlength="50"/></td>
<td height="40" align="center" bgcolor="f3f3f3">QQ号码:</td>
<td height="40" align="left"><input type="text" name="qq" id="qq" maxlength="20"/></td>
</tr>
<tr>
<td height="40" align="center" bgcolor="f3f3f3">留言主题:</td>
<td height="40" align="left" colspan="3"><input type="text" style="width:551px;" name="liuyan" id="liuyan" maxlength="50"/><span class="redFont" style="position:relative;*top:-4px;">*</span></td>
</tr>
<tr>
<td height="178" align="center" bgcolor="f3f3f3">内 容</td>
<td height="178" align="left" colspan="3"><textarea style="width:551px;height:160px;" name="neirong" id="neirong"></textarea><span class="redFont" style="position:relative;top:-67px;*top:-71px;">*</span></td>
</tr> </table> <tr>
<td height="70" align="center" colspan="4">
<!-- <a href="###" class="surveySubmit" style="margin-left:226px;">提 交</a>
<a href="###" class="surveyView">重 置</a> -->
<input type="button" name="button" class="surveySubmit" onclick="sub()" style="margin-left:226px;margin-top:30px;" value="提交" style="border:0px;">
<input type="button" name="button" class="surveyView" style="margin-top:30px" onclick="reset()" value="重置" style="border:0px;" >
</td>
</tr> </form>
</div>
之前的有点问题,自己改过来的
最新文章
- Python 随机数用法
- BootStrap框架
- iOS runtime 的经典作用
- apache httpclient 4.5 兼容 http https
- Windows下Nginx+Tomcat整合的安装与配置
- 使用自定义的item、Adapter和AsyncTask、第三方开源框架PullToRefresh联合使用实现自定义的下拉列表(从网络加载图片显示在item中的ImageView)
- Corn Fields
- 关于ios 程序加载百度地图lib,出现链接错误:找不到符号 (null): _OBJC_CLASS_$_BMKMapManager的解决办法
- 5分钟快速入门 - Less
- WPF DataGridHyperlinkColumn
- Nexus私服忘记用户名密码解决4步走
- Django 实现list页面检索
- 关于select的id以及value传给后台的问题
- 微信小程序—文件系统
- [NOIP2018]普及组游记
- npm install 项目安装遇到问题
- 第三章 document对象及数组
- spring bean 生命周期和 ? 作用域? spirng bean 相互依赖? jvm oom ? jvm 监控工具? ThreadLocal 原理
- 解决linux下安装nodejs后npm未成功安装的问题
- 带状态论文粗读(三)[引用openstate的相关论文阅读]
热门文章
- HTML 5 全局属性
- [FTP] FTPHelper-FTP帮助类,常用操作方法 (转载)
- Oracle11g服务及实例
- Swift基础知识入门(基于Swift2.0)
- iOS Core Animation学习总结(1)--CALayer常用属性
- JS 同源策略
- wamp5.2 升级到wamp5.3 (转载)
- 使用APPLICATION制作缓存,转存一下,有一段写的还可以。
- 关于js效果不提示就执行了刷新(解决 在h-ui框架中)
- js学习--浏览器对象计时器setInterval()与setTimeout()的使用与区别