目前代码会提示一个注册成功的框,点击那个确认实现跳转页面功能

qq_16359761 2016-07-20 04:03:41

<!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>
<title>用户注册</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="新建文本文档.txt" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
body {
background-color: #F6F6F6;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
.STYLE1 {font-family: "楷体"}
body,td,th {
font-family: 楷体;
}
-->
</style>
<script type="text/javascript">
function checkform()
{
var username = document.getElementById('username').value;
var pwd1 = document.getElementById('password').value;
var pwd2 = document.getElementById('password2').value;
var an = document.getElementById('anniu').checked;
var x=1;

if(an=="")
{
alert("请阅读用户协议")
return false;
}
if(username == '' || pwd1 == '' || pwd2 == '')
{
alert("请填写必填项");
return false;
}
var reg = /^(\d|\w|\d\w){6,16}$/;
if(reg.test(username) == false){
alert("用户名格式不对");
return false;
}
if(reg.test(pwd1) == false){
alert("密码格式不对");
return false;
}
if(pwd1 != pwd2){
alert("两次密码不一致");
return false;
}
if(x==1)
{
alert("注册成功");
}
}

</script></head>
<body>
<div style="position:absolute; margin-left:70%; margin-top:4%; left: 10px; top: 76px;">

<p>有帐号?直接<a href="e">登录</a></p>
</div>

<form method="post" name="form1" id="form1" onsubmit="return checkform()">
<div class="STYLE1" style="margin-top:10%;margin-left:20%; width:60%; background-color:#FFFFFF; color: #353535 ">

<table width="650" border="0" cellpadding="8" class="STYLE1">
<tr>
<td height="82" colspan="3" class="HeaderColor"> <h4 align="left">
欢迎注册
</h4>
<hr />
<h4 align="right"> </h4></td>
</tr>
<tr style="vertical-align: top">
<td width="335" class="LabelColor" style="text-align: right">
<label for="username"> *帐号 </label></td>
<td width="388" colspan="2" class="TitleColor">

<div align="left">
<input name="username" type="text" id="username" size="25" maxlength="20" style="color:#ccc" value="输入6-16个字符" onfocus="this.value='',this.style.color='#000000'" />
</div></td>
</tr>
<tr style="vertical-align: top">
<td width="335" class="LabelColor" style="text-align: right">
<label for="password">
<div align="right">*密码</div>
</label>
</td>
<td colspan="2" class="TitleColor">

<div align="left">
<input name="textfield2" type="text" id="password" size="25" maxlength="16"style="color:#ccc" value="输入6-16位字符" onfocus="this.value='',this.style.color='#000000'" />
</div>
</td>
</tr>
<tr style="vertical-align: top">
<td width="335" height="32" class="LabelColor" style="text-align: right">
<label for="confirmpassword">
<div align="right">*再次输入密码</div>
</label>
</td>
<td colspan="2" class="TitleColor">
<div align="left">
<input name="textfield3" type="text" id="password2" size="25" maxlength="16" style="color:#ccc" value="输入6-16位字符" onfocus="this.value='',this.style.color='#000000'"/>
</div>
</tr>
<tr style="vertical-align: top">
<td style="text-align: right" class="LabelColor"><label for="confirmpassword">
<div align="right">
<input type="checkbox" name="radiobutton" value="radiobutton" id="anniu" />
</div>
</td>
<td colspan="2" class="TitleColor"><label>
<div align="left">我已阅读<a href="民大益易用户协议书.txt">《民大益易用户协议书》</a></div>
</label>
</td>
</tr>
<tr style="vertical-align: top" class="FooterColor">
<td colspan="3">

<div align="center">
<input name="SubmitName" type="submit" id="cg" style="width:190px; height:40px; background-color: #FF3300" value="立即注册" onclick="" />

</div></td>
</tr>
</table>
</div>
</form>

</body>
</html>
...全文
291 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
chanel_1 2016-07-20
  • 打赏
  • 举报
回复
三种办法, 1.写个定时器,alert之后多长时间页面跳转 2.不用系统的alert,自己写弹框,这样可以获取 到用户点击了确定后进行后续擦偶哦 3.改写系统的alert,window.alert=
sinat_32709809 2016-07-20
  • 打赏
  • 举报
回复
window.location.href="XXXX.html"
sinat_32709809 2016-07-20
  • 打赏
  • 举报
回复
window.location="XXXX.html"
笨猿 2016-07-20
  • 打赏
  • 举报
回复
onclick="" 改为 onclick="checkform()"; if(x==1) { alert("注册成功"); } 改为 if(x==1) { alert("注册成功"); window.location="1.html" } 结贴 给分

87,992

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧