為什么點新窗口打開網(wǎng)站沒反應(yīng)???求解啊
<!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("是否打開對話框");
? ? ? ? if(open){
? ? // 新窗口打開時彈出確認框,是否打開
? ? ? ? var url=prompt("通過輸入對話框,確定打開的網(wǎng)址", "http://idcbgp.cn/");}
? ? // 通過輸入對話框,確定打開的網(wǎng)址,默認為 http://idcbgp.cn/
? ? ? window.open(url,'_blank','width:400','height:500','menubar:no','toolbar:no');
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ??
? ??
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2017-10-28
你的prompt函數(shù)中再傳網(wǎng)頁參數(shù)時:是中文狀態(tài),url肯定不對;
在open函數(shù)中對屬性進行賦值時應(yīng)該是width=xxx的形式;