為何打開的窗口無法顯示出網(wǎng)站內(nèi)容
<!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 myconfirm = confirm("是否打開窗口");
? ? ? ? if(myconfirm==true)
? ? ? ? {
? ? ? ? ? ? var web = prompt("打開哪個窗口","http://idcbgp.cn");
? ? ? ? ? ? // 通過輸入對話框,確定打開的網(wǎng)址,默認為 http://idcbgp.cn/
? ? ? ? ? ? window.open('web','_blank','width=400px,height=500px,menubar=no,toolbar=no')
? ? ? ? ? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ? ? ? }
? ? }
? ??
? </script>?
?</head>?
?<body>?
? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2018-05-28
?window.open('web','_blank','width=400px,height=500px,menubar=no,toolbar=no')
web不要加引號
2018-05-28
?window.open('web','_blank','width=400px,height=500px,menubar=no,toolbar=no')
這一句里邊web是一個變量,不要加單引號引起來,否則引用不到 window.open(web,'_blank','width=400px,height=500px,menubar=no,toolbar=no')