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