為啥不彈窗
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title>??
? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>? ?
? <script type="text/javascript">??
? function openwindow(){
? ? var open=confirm("確認新建窗口打開網(wǎng)站嗎?");
? ?if? (open==true)? ? {
? ? ?var url=prompt("請輸入打開網(wǎng)址:http://idcbgp.cn");
? ? ? ? ?if (url!=null)? {
? ? ? ? ? ? ?window.open(url,'_blank','width=400px,heigth=500px,menubar=no,toolbar=no')
? ? ? ? ?}//打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ? ? ? else?
? ? ? ? {
? ? ? ? ? ? alert("輸入錯誤,請重新輸入");
? ? ? ? }
else{
? ? alert("再見")}
}
? ??
? </script>?
?</head>?
?<body>?
? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2022-12-11
openWindow(),你大小寫寫錯了
2022-03-17
var后面不能直接用open,隨便用個字母代替一下應(yīng)該就可以了