輸入密碼后打開指定頁面
作者:晉城網站建設 日期:2010-02-15
第一步:把如下代碼加入首頁(本例為password1.htm)的<head>區域中
<SCRIPT LANGUAGE="javascript">
<!--- Hide
var new_window = null;
function password() {
new_window = window.open('password2.htm', 'pass', 'width=350,height=150,resizable=1');//你可以改變鏈接和窗口大小
}
//--->
</SCRIPT>
第二步:在首頁(本例為password1.htm)的<body>區域中加入(用來調用輸入密碼頁)
<A HREF="javascript:password()">這里</A>
第三步:在password2.htm(你可以自己隨著設定)頁面<head>中加入
<SCRIPT LANGUAGE="JavaScript">
<!--Hide
function goForit() {
var location;
var password;
password=this.document.testform.inputbox.value
location=password + ".htm"
fetch(location)
theKeeper=window.close()
}
function fetch(location) {
var root;
if (opener.closed) {root=window.open('','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=no');
root.location.href = location;
} else {
opener.location.href = location;
}
}
//-->
</SCRIPT>
第四步:在password2.htm(你可以自己隨著設定)頁面<body>中加入
<CENTER>
<FONT SIZE=3>輸入密碼,然后按submit進入密碼頁(即進入相應的time1.htm頁面中)</FONT>
<FORM NAME="testform">
<INPUT TYPE="text" NAME="inputbox" VALUE="" size=20>
<INPUT TYPE="button" NAME="button" Value="Submit" onClick="goForit(this.form)"></FORM>
</FONT><p>
密碼為:time1
</CENTER>