為啥打不開
<!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 a=confirm("是否打開")
? ? ? ? ? if (a==true)
? ? ? ? ? window.open("http://idcbgp.cn/'_blank','width=400,height=500,menubar=no,toolbar=no')
? ? }
?</script>
?</head>?
?<body>?
? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2018-11-10
<!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()?
? ? {
? ? ? ? var open = confirm("打開網(wǎng)站");
? ? ? ? if (open == true) {
? ? ? ? ? ? var input = prompt("請輸入網(wǎng)址", "http://idcbgp.cn");
? ? ? ? ? ? window.open(input, "_blank", "width=400,height=500,menubar=no,toolbar=no")
? ? ? ? }
? ? }
? </script>?
?</head>?
?<body>?
? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
我用的google瀏覽器,上面這段代碼最后也沒打開網(wǎng)站,但我在為w3cschool里運(yùn)行是能打開的,估計是慕課的問題吧
2018-10-28
將你的window.open()改成這個
就應(yīng)該可以了
2018-10-27
window.open傳三個參數(shù) 路徑,名字,窗口屬性? ?每一個屬性都是字符串類型 所以用""包括 用,分割
你再第一個網(wǎng)站路徑后漏掉了一個"
2018-10-27
你那個雙引號什么鬼?window.open("http://idcbgp.cn/'_blank','width=400,height=500,menubar=no,toolbar=no')
這句代碼里有一個雙引號沒有閉合