javascript一問

2007-01-24 5:03 pm
javascript一問
請問我用javascrit做左一個假既登入系統,但係我想佢登入果陣果個超連結會開新既ie黎睇
請問果個語法係咩.?(以下為假登入系統需要此語法)
if (username=="xxx" && password=="xxx")
{ window.location="http://xxxxxxxxxxxxxxxxx"; done=1;target="_top" }
if (done==0) { alert("帳號或密碼錯誤,請重試!"); }

回答 (2)

2007-01-24 7:37 pm
✔ 最佳答案
Try the following code:
<html>
<head><title>window.open</title>
<SCRIPT LANGUAGE=“JAVASCRIPT”>
<!-- hide JavaScript code from browsers that are not JavaScript enabled
function popupwin() {
if (username==“xxx” && password==“xxx”) {
window.open('http://hk.yahoo.com', 'popup', 'height=500, width=400, menubar=no, scrollbars=no, status=no, toolbar=no, screenX=100, screenY=0, left=100, top=0');
}
else {
alert(“帳號或密碼錯誤,請重試!”);
}
}
</SCRIPT>
</head>

<body>
<FORM NAME=“FORM1”>
Username: <INPUT type=“text” name=“username”><BR>
Password: <INPUT type=“text” name=“password”><BR>
<INPUT TYPE=“BUTTON” VALUE=“Popup Window” ONCLICK=“popupwin();”>
</FORM>

</body>
2007-01-24 6:26 pm
你ge意思係個超連結會開新既window?

if (username == "xxx" && password == "xxx") {
window.open("http://www.yahoo.com/");
} else {
alert("帳號或密碼錯誤,請重試!");
}


收錄日期: 2021-04-23 19:12:50
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20070124000051KK00543

檢視 Wayback Machine 備份