<!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>
分享到:
相关推荐
本文实例讲述了JS定义网页表单提交(submit)的方法。分享给大家供大家参考。具体如下: 这段代码表示网页表单提交时不是提交到指定的页面,而是执行一个特定的函数 [removed] function saveInfo() { localStorage...
js验证表单大全js验证radio是否选择 <script language="javascript">function checkform(obj){for(i=0;i;i++) if(obj.oo[i].checked==true) return true; alert("请选择")return false; }</script><form id="form1...
return false会阻止表单提交,基本上关于onsubmit=return false有以下几点要注意的地方,学习后台编程的朋友一定要知道。
在form表单上添加一个提交事件调用验证数据方法 <form name="listform" action="resume-doAdd" method="post" onsubmit="return Validator.Validate(this,3);"> <input type="text" id="linkPhone" name=...
代码如下:/** * 表单提交校验 **/function onSubmit(){ if($(‘#name’).val().length<2){ alert(“名称请不少于两个汉字”); return false; } var t = new Date().getTime(); $.ajax({ type: ...
<form name="formname" onSubmit="return validateForm(this)"> 将对表单中的所有以下类型的域依次验证,所有验证是去除了前导和后缀空格的,要注意是区分大小写的。 2、空值验证 表单中任意域加上emptyInfo属性...
本文实例为大家分享了JavaScript实现异步获取表单数据的具体代码,供大家参考,具体内容如下 在上一篇文章中讲到了使用JavaScript异步提交表单中的数据,那么今天我们就讲讲利用JavaScript异步获取表单中的数据;...
在进行表单提交时,需要对输入框和文本域等的value的合理性进行验证,可以编写form的onSubmit事件,代码,踩过的坑;注意点: 1、只有通过form里面的 <button type="submit" >提交</button>进行表单的...
使用EasyUi我们可以在客户端表单提交之前进行验证,过程如下:只需在onSubmit的时候使用return $(“#form1”).form(‘validate’)方法即可,EasyUi中form模块中的from(‘validate’)方法会自行对我们指定的表单中...
本文实例分析了JS两种类型的表单提交方法。分享给大家供大家参考,具体如下: 1.原始的 <form method="post" action="/student/stureg/add" id="form1" onsubmit="return subForm();"> <button type=...
第三步:对用户输入的数据进行判断 第四步:数据合法(让表单提交) 第五步:数据非法(给出错误提示信息,不让表单提交) 问题:如何控制表单提交? 关于事件 onsubmit:一般用于表单提交的位置,那么需要在定义函数的...
js表单验证控制代码大全 /* 目录: 1:js 字符串长度限制、判断字符长度 、js限制输入、限制不能输入、textarea 长度限制 2.:js判断汉字、判断是否汉字 、只能输入汉字 3:js判断是否输入英文、只能输入英文 4:js只能...
表单与javascript的课件,ppt中有源码,可以直接复制过来运行,是很好的教学资源: ... <INPUT TYPE="submit" value="提交此表单" > <INPUT TYPE="reset" value="重置"> </FORM></BODY> </html>
使用EasyUi我们可以在客户端表单提交之前进行验证,过程如下:只需在onSubmit的时候使用return $(“#form1”).form(‘validate’)方法即可,EasyUi中form模块中的from(‘validate’)方法会自行对我们指定的表单中...
jsp中有关表单的一些操作,对初学这有很大帮助例子1:复选框例子 <form method=post action="http://baidu.com/do.jsp" target="_blank" onsubmit="doMethod();return false;"> <input type="checkbox" name=ch1 ...
本文实例讲述了Yii框架表单提交验证功能。分享给大家供大家参考,具体如下: 一、前端提交的三种方式 前面已经提出,表单提交一共只有三种方式。... onSubmit="return validationFunc"> ... </form
表单具有 onsubmit = “return check()”行为,处理验证情况 点击提交表单按钮时,进行最终的验证,达到是否通过表单提交的请求。 先是最基本的html+css部分 <style type="text/css"> body{margin:0;...
在导师的催促下就总结出以下的几种常用表单提交的方法。 第一种方式:表单提交,在form标签中增加onsubmit事件来判断表单提交是否成功 [removed] function validate(obj) { if (confirm("提交表单?")) {...
form action="clock.html" method="post" onsubmit="return checkLength()"> <p>name:<input type="text" name="user" id="user"> <input type="submit" id="submit" name="submit"> </form>...
form表单提交数据给servlet,采用doget和dopost <form id="form1" name="form1" method="post" action="${pageContext.request.contextPath }/user" onSubmit="return check()"> <input type="hidden" name=...