Debugging 这是弹出窗口的正确代码吗?
我想让这个代码在密码正确时弹出一个窗口,当密码不正确时,我想让它进入google.comDebugging 这是弹出窗口的正确代码吗?,debugging,Debugging,我想让这个代码在密码正确时弹出一个窗口,当密码不正确时,我想让它进入google.com <!DOCTYPE html> <html> <head> </head> <body> <script language="Javascript"> <!--hide var password; var pass1="12345"; <a href="https://www.google.com/?safe=active
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script language="Javascript">
<!--hide
var password;
var pass1="12345";
<a href="https://www.google.com/?safe=active&ssui=on"
target="_blank" onclick="preventProp(event)">Google</a>
function preventProp(e){
if(confirm("Are you sure you want to open this link ?")){
return true;
}
password=prompt("Enter Password To View Zapazzi","");
if(password!==pass1)
window.confirm("Incorrect Password, click ok to go to Google");
else
{
alert("Correct Password, click ok to go to Zapazzi");
window.location="https://sites.google.com/cusdk8.org/zapazzi/home";
}
//-->
</script>
</body>
</html>
这是你必须做的 从中删除 将脚本类型更改为
更改代码,只需知道这绝对不提供任何安全性。不过,HTML5中不需要type=text/javascript。
<!DOCTYPE HTML>
<HTML>
<head>
</head>
<body>
<button onclick="preventProp(event)">Google</button>
<script type="text/javascript">
var password;
var pass1="12345";
function preventProp(e){
if(confirm("Are you sure you want to open this link ?")){
return true;
}
password=prompt("Enter Password To View Zapazzi","");
if(password !== pass1)
window.confirm("Incorrect Password, click ok to go to Google");
else{
alert("Correct Password, click ok to go to Zapazzi");
window.location="https://sites.google.com/cusdk8.org/zapazzi/home";
}
}
</script>
</body>
</html>