论坛: 网站建设 标题: 请教高手一个问题? 复制本贴地址    
作者: nallfather [nallfather]    论坛用户   登录
哪位能帮我写一段JAVASCRIPT,是密码验证用的,进入页面,要求输入提前设定的密码(如123),如果输入正确则进入,输入错误则进入指定的另一页面,小弟在此先谢过了!!!

地主 发表时间: 04-03-16 20:21

回复: wlbyyh [wlbyyh]   论坛用户   登录
<script language = "javascript">
//设用户验证页面有两个文本框,分别输入用户名和密码的,第一个为T1,第二个为T2,表单名为form1
if(form1.T1.value == "" || form1.T2.value != 123)
alert("请输入正确的用户名和密码")
window.location = "err.htm" //错误页面
else
window.location = "index.htm" //正确页面
</script>

B1层 发表时间: 04-03-20 09:23

回复: nallfather [nallfather]   论坛用户   登录
谢谢楼上D朋友,

B2层 发表时间: 04-03-28 17:16

回复: jsj0132 [jsj0132]   论坛用户   登录
厉害

B3层 发表时间: 04-03-28 19:46

回复: dgdm [dgdm]   论坛用户   登录
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
<SCRIPT LANGUAGE="JavaScript">
function password() {
var testV = 1;
var pass1 = prompt('请输入密码:','');
while (testV < 3) {
if (!pass1)
history.go(-1);
if (pass1 == "dgdm.go.nease.net") {
alert('密码正确!可以进入');
break;
}
testV+=1;
var pass1 =
prompt('密码错误!请重新输入:');
}
if (pass1!="password" & testV ==3)
history.go(-1);
return " ";
}
document.write(password());
</SCRIPT>
</head>

<body bgcolor="#CCCCCC">
<p align="center">&nbsp; </p>
<p align="center"><strong><font color="#008000" size="7">欢迎来到独孤蝶梦网页首页是:dgdm.go.nease.net</font></strong></p>

<p align="center"> <a href="#">首页</a></p>

<p align="center"> </p>

<p align="center"><a href="http://xuezhe.net" target="_blank"><img border="0" src="logo_1.gif" width="233" height="65"></a></p>


B4层 发表时间: 04-03-28 23:16

论坛: 网站建设

20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon

粤ICP备05087286号