請(qǐng)問(wèn)問(wèn)題出在哪?
<!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(“確定打開(kāi)網(wǎng)頁(yè)嗎?”);
? ? ? ? if(open==ture)
? ? {window.open('http://idcbgp.cn','_blank','width=400,height=500,menubar=no,toolbar=no');
? ? }
? ?else
? ?{alert(取消)
? ?}
? ??
? ??
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開(kāi)網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2018-08-16
http://idcbgp.cn?加個(gè) / 隔開(kāi)
參考我的代碼
?function openWindow(){
? ? ? ? // 新窗口打開(kāi)時(shí)彈出確認(rèn)框,是否打開(kāi)
? ? ? ? var adds = prompt("如果同意打開(kāi)新窗口,請(qǐng)輸入網(wǎng)址");
? ? ? ? // 通過(guò)輸入對(duì)話框,確定打開(kāi)的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
? ? ? ? if (adds=="http://idcbgp.cn/"){
? ? ? ? ? ? //打開(kāi)的窗口要求,寬400像素,高500像素,無(wú)菜單欄、無(wú)工具欄。
? ? ? ? ? ? window.open(adds, '_blank', 'width=400, height=400, menubar=no, toolbar=no');
? ? ? ? ? ? return;
? ? ? ? }
? ? ? ? if (adds==null){
? ? ? ? ? ? alert("您取消打開(kāi)新窗口");
? ? ? ? ? ? return;
? ? ? ? }
? ? ? ? alert("請(qǐng)重新輸入慕課網(wǎng)首頁(yè)地址")
? ? ? ? openWindow();
? ? }