用confirm為什么不會彈出對話框??
<!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 rst=confirm("是否打開網(wǎng)址");
? ??
? ? if(rst==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>
//為什么我的會運行不了,有點不懂大家這么都在用prompt,我這個地方用的是confirm
2018-10-03
你的代碼內(nèi)_blank,后面的一段有兩處錯誤,一是500與menubar之間沒有用,隔開,二是width=400,height=500menubar=no,toolbar=no沒有用引號圈起來。
以下是修改后的代碼:
?window.open('http://idcbgp.cn','_blank','width=400,height=500,menubar=no,toolbar=no')
(一個小建議,以后打代碼的時候把代碼排版得整齊一點,這樣更方便自己分析內(nèi)部的邏輯關系。)
2018-10-02
少個逗號,參數(shù)鏈表那里
2018-10-01
你的代碼都是正確的,你是不是沒點下面的提交?? ?而且用confirm是完全正確的
2018-10-01
需要在 function 前面調(diào)用函數(shù)?openWindow();
2018-10-01
因為你沒有調(diào)用這個函數(shù)