输入正确的邀请码 点击确认后,隐藏这个div层,显示提交成功 怎么实现?

win777777 2017-01-30 10:34:49
<!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=gb2312" />
<title>测试</title>
</head>
<body>
<form id=cnwy name=cnwy onSubmit="return checkform()" action=123456789.asp method=get>
<input type="hidden" value="123" name="password" />
<script type="text/javascript">
<!--
function checkform() {
if( cnwy.password2.value =="" || cnwy.password2.value.length<1 || cnwy.password2.value.length>20) {
alert("请输入邀请码!")
return false;
}
if( cnwy.password.value != cnwy.password2.value ) {
alert("邀请码错误!")
return false;
}
return true;
}
function isNumberString (InString,RefString)
{
if(InString.length==0) return (false);
for (Count=0; Count < InString.length; Count++) {
TempChar= InString.substring (Count, Count+1);
if (RefString.indexOf (TempChar, 0)==-1)
return (false);
}
return (true);
}
// -->
</script>
<form
action="index2.asp" method="post" name="form1" id="form1" onSubmit="return CheckForm();">
邀请码:
<input style="font-size:16px"maxlength="20" size="5" name="password2" />
<input type="submit" value="确认">
</form>


<p> </p>
<p> </p>


<!---->
<script>
function jh(){
document.getElementById("div1").style.display="none";
document.getElementById("div2").style.display="";
}
</script>
<div id="div1">
<input type="button" onclick="jh()" value="提交" />
</div>
<div id="div2" style="display:none;">您已经提交成功</div>
<!---->
</body>
</html>
...全文
409 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
什么都不能 2017-02-03
  • 打赏
  • 举报
回复
这么玩没意思,用个前端的框架easyUI, extJS, bootstrap, angularJS
天际的海浪 2017-01-30
  • 打赏
  • 举报
回复
邀请码别放到前台啊,放到前台不安全,要用asp后台程序判断。 你这是form表单刷新页面提交的方式,直接在另一个index2.asp文件中写<div id="div2">您已经提交成功</div> 如果index2.asp就是本页面。就要用asp后台程序判断。
<script type="text/javascript">
function checkform() {
var c = document.getElementById("form1");
if( c.password2.value =="" || c.password2.value.length<1 || c.password2.value.length>20) {
alert("请输入邀请码!")
return false;
}
return true;
}
  </script>

<% If Request.Form("password2")="" Then %>
<form 
      action="index2.asp" method="post" name="form1" id="form1" onSubmit="return checkform()">
  邀请码:
  <input style="font-size:16px"maxlength="20" size="5" name="password2" />
  <input type="submit" value="确认">
</form>
<% ElseIf Request.Form("password2")="123" Then %>
<div id="div2">您已经提交成功</div>
<% Else %>
<div id="div2">邀请码错误!</div>
<% End If %>

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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