為什么窗口打不開
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> ??
? <script type="text/javascript"> ?
function openWindow() {
? ? // 新窗口打開時(shí)彈出確認(rèn)框,是否打開
?var opentag=confirm("是否在新窗口打開網(wǎng)站?");
?if(opentag==true)
? ? {
? ? ? var webadress=("通過輸入對(duì)話框,確定打開的網(wǎng)址","http://idcbgp.cn");
? }
? ? // 通過輸入對(duì)話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
? ?if(webadress!=null)
? {?
? ? ? window.open(webadress,"_blank",'width=400,height=500,menubar=no,toolbar=no');
? }
? ?else
? ?{alert("結(jié)束");}
? ?
? ?}
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? else
{alert("結(jié)束");}
??
}
? ??
? ??
? </script>?
?</head>?
?<body>?
? ? ? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2017-07-28
你這大括號(hào)不多一個(gè)嗎
2017-07-27
只需要改成這樣就行了:?window.open(webadress,'_blank','width=400,height=500,menubar=no,toolbar=no');
我試過了,可以運(yùn)行!
2017-07-27
? window.open(webadress,"_blank",'width=400,height=500,menubar=no,toolbar=no');
這行代碼,你的單雙引號(hào),只能用一種,不能2種都在這語句中應(yīng)用。
? window.open(webadress,'_blank','width=400,height=500,menubar=no,toolbar=no');
2017-07-27
還是不可以
2017-07-26
http://idcbgp.cn/改成http://idcbgp.cn/,冒號(hào)是英文的