誰能幫忙看下為什么不彈出對話框,點擊無反應(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("確認新建窗口打開網(wǎng)址嗎?");
? ? ? ? if(open==true){
? ? ? ? ? ? // 通過輸入對話框,確定打開的網(wǎng)址,默認為 http://idcbgp.cn/
? ? ? ? ? ? var url=prompt("通過輸入對話框,確定打開的網(wǎng)址","http://idcbgp.cn/");
? ? ? ? ? ? if("http://www.com.imooc.com/".equals("url")){
? ? ? ? ? ? ? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ? ? ? ? ? ? ? window.open('http://idcbgp.cn/','_blank','width=400','height=500','menubar=no','toolbar=no');
? ? ? ? ? ? }else{
? ? ? ? ? ? ? ? alter("請輸入正確的網(wǎng)址");
? ? ? ? ? ? }
? ? ? ? }else{
? ? ? ? ? ? alter("再見");
? ? ? ? }
? ? }
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()"/>?
?</body>
</html>
2017-09-02
沒錯啊,我試了下,你的源代碼可以打開啊
2017-09-15
?var url=prompt("通過輸入對話框,確定打開的網(wǎng)址"," http://idcbgp.cn/");
你的這句有問題,括號標點都是英文的,這個是改過的。還有你的alert寫錯了