<!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=<?php echo $cfg_soft_lang; ?>" />
<title>更改帐号基本资料 - 会员中心 - <?php echo $cfg_webname; ?></title>
<script type="text/javascript">
function checkSubmit()
{
if(document.form2.oldpwd.value=='')
{
document.form2.oldpwd.focus();
alert("旧密码必须填写!");
return false;
}
if(document.form2.userpwdok.value!=document.form2.userpwd.value)
{
document.form2.userpwdok.focus();
alert("两次密码不一致!");
return false;
}
if(document.form2.email.value=="")
{
document.form2.email.focus();
alert("Email不能为空!");
return false;
}
if(document.form2.uname.value=="")
{
document.form2.uname.focus();
alert("用户昵称不能为空!");
return false;
}
if(document.form2.vdcode.value=="")
{
document.form2.vdcode.focus();
alert("验证码不能为空!");
return false;
}
}
</script>
</head>
<body>
<!--提交表单前先执行checkSubmit(),检查表单各项是否合规-->
<form action="edit_baseinfo.php" method="post" enctype="multipart/form-data" name="form2" onsubmit="return checkSubmit();">
<input type="hidden" name="dopost" value="save" />
<div class="postForm">
<p class="cellBg">
<label style="width:90px">昵称:</label>
<input name="uname" type="text" id="uname" value="<?php echo $row['uname']; ?>" class="intxt" style="width:100px"/>
</p>
<p>
<label>原登陆密码:</label>
<input name="oldpwd" type="password" id="oldpwd" class="intxt" /> <span style="color:red;">*</span>
</p>
<p class="cellBg">
<label>新密码:</label>
<input name="userpwd" type="password" id="userpwd" class="intxt" />
<span id="_userpwdok">(不修改密码请保留此项为空)</span>
</p>checkSubmit()
<p>
<label>确认新密码:</label>
<input name="userpwdok" type="password" id="userpwdok" value="" class="intxt" />
<span id="_userpwdok2">(不修改密码请保留此项为空)</span> </span>
</p>
<p class="cellBg">
<label><span class="tdl">电子邮箱</span>:</label>
<input name="email" type="text" id="email" value="<?php echo $row['email']; ?>" class="intxt"/><br>
<span id="_email" style="margin-left:80px"> <span style="color:red;">*</span> (每个电子邮邮箱只能注册一个帐号,要修改电子邮箱必须填写正确安全问题的答案)</span>
</p>
<p class="cellBg">
<label>验证码:</label>
<input name="vdcode" type="text" id="vdcode" style='width:50px;text-transform:uppercase;' class="intxt" />
<img src="../include/vdimgck.php" align="absmiddle" alt="看不清?点击更换" style="cursor:pointer" onclick="this.src=this.src+'?'" />
</p>
<p>
<button class="button2" type="submit">更新</button>
<button class="button2 ml10" type="reset">重设</button>
</p>
</div>
</form>
</body>
</html>

如果是onsubmit="return false;"则是表示阻止表单提交,例:<form name="form1" method="post" onsubmit="return
false;"></from>

提交表单之前对表单进行检查的方法 onsubmit="return checkSubmit();"的更多相关文章

  1. 谈谈Enter回车键提交表单那些事 回车搜索 enter搜索

    我们在做系统前端的时候,往往会用到form标签,采用jquery插件做表单验证.我们信誓旦旦的一位把一切都做好的时候,并且检查一遍又一遍的时候,意向不到的事情发生了,也许是出于一种意外,而这种意外我们 ...

  2. JQuery ajax提交表单及表单验证

    JQuery ajax提交表单及表单验证 博客分类: jsp/html/javascript/ajax/development Kit 开源项目   注:经过验证,formValidator只适合一个 ...

  3. js防止回车(enter)键提交表单及javascript中event.keycode

      如何防止回车(enter)键提交表单,其实很简单,就一句话.onkeydown="if(event.keyCode==13)return false;"把这句写在from标签里 ...

  4. 前端表单中有按钮button自动提交表单

    问题描述 在设计表单时,表单内有一个按钮<button>,该按钮是用来获取其他数据或执行其他操作的.并不是让他提交表单. 解决方案 1) 设置 form 的 onsubmit='retur ...

  5. JS:JS判断提交表单不能为空等验证

    这段代码在<form>中有οnsubmit="return on_submit()",如果 onsubmit ()返回 fasle,表单的元素就不会提交,即action ...

  6. HTML5对表单的约束验证

    在HTML5中增加了许多新的功能,用于表单提交到服务器之前对表单进行数据的验证(抢了javascript的饭碗),有了这些功能,即便是javascript没有加载进来还是可以确保基本的验证.换句话说, ...

  7. onsubmit对表单的拦截

    今天遇到一个问题:在对同name 的input 表单时 判断其值是否有效 用了each判断 当初错误的做法: function check_goods() { var regs = /^\d+$/; ...

  8. ASP.NET MVC 网站开发总结(五)——Ajax异步提交表单之检查验证码

    首先提出一个问题:在做网站开发的时候,用到了验证码来防止恶意提交表单,那么要如何实现当验证码错误时,只是刷新一下验证码,而其它填写的信息不改变? 先说一下为什么有这个需求:以提交注册信息页面为例,一般 ...

  9. jquery 通过submit()方法 提交表单示例

    jquery 通过submit()方法 提交表单示例: 本示例:以用户注册作为例子.使用jquery中的submit()方法实现表单提交. 注:本示例仅提供了对表单的验证,本例只用选用了三个字段作为测 ...

随机推荐

  1. c# 汉字换英文,英文转汉字

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  2. 【转】HTTP协议/IIS 原理及ASP.NET运行机制浅析【图解】

    源地址:http://blog.csdn.net/chelen_jak/article/details/50040537

  3. HTTP,HTTPS端口号

    博主暂做个笔记,查询资料再纠正~~~~小白不要不假思索的抄走~~~ 一般情况下,HTTP默认工作端口是8000,HTTPS默认工作端口是443

  4. P2866 [USACO06NOV]糟糕的一天Bad Hair Day

    题意:给你一个序列,问将序列倒过来后,对于每个点,在再碰到第一个比它大的点之前,有多少比它小的? 求出比它小的个数的和 样例: 610374122 output: 5 倒序后:2    12    4 ...

  5. atcoder 2579

    You are taking a computer-based examination. The examination consists of N questions, and the score ...

  6. Django 08 Django模型基础3(关系表的数据操作、表关联对象的访问、多表查询、聚合、分组、F、Q查询)

    Django 08 Django模型基础3(关系表的数据操作.表关联对象的访问.多表查询.聚合.分组.F.Q查询) 一.关系表的数据操作 #为了能方便学习,我们进入项目的idle中去执行我们的操作,通 ...

  7. Codeforces - 722C 区间合并

    要求断裂的数列之和的最大值,只需在断裂处的下标修改为一个足够负无穷大的值就可以用线段树维护 这道题数据还是弱了点,如果n和ai均取最大可能我这个程序早就爆ll了(4e4的时候炸了),毕竟本来想着用GC ...

  8. codeforces 620D Professor GukiZ and Two Arrays

    #include <bits/stdc++.h> using namespace std; + ; const long long inf = 1e18; int n, m; long l ...

  9. hdu3746 KMP-next数组的应用

    Cyclic Nacklace Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)T ...

  10. slf4j + loback配置

    目前Java主流的log体系是 Slf4j +logback Spring boot 中配置log十分简单,常见的方式在application.yml文件中使用如下配置 logging: path: ...