為什么我的代碼點(diǎn)擊按鈕無(wú)反應(yīng),還有函數(shù)命名問題
<!DOCTYPE?html> <html> <head> <meta?charset="UTF-8"> <title>Document</title> <script?type="text/javascript"> function?Wopen()?{ var?open=confirm("確定打開?"); if?(open==true)?{ var?url=prompt("打開新窗口?","http://idcbgp.cn"); if?(url!=null)?{ window.open(url,"http://idcbgp.cn","_blank","width=400px,height=500px,menubai=no,toolbar=no"); } else?{ alert("goodbye"); } }?else?{ alert("goodbye"); } </script> </head> <body> <input?name="button"?type="button"?onclick="Wopen"?value="打開新窗口"/> </body> </html>
如題,自己也找不到錯(cuò)誤。
代碼中的Wopen open url 是唯一指定的名字還是可以替換,或者是隨便怎么命名都可以。
之前我做打開窗口練習(xí)的時(shí)候,函數(shù)名命名為Wopen才有效果,隨便起個(gè)名字怎么試都不行。
百度也搜不到相關(guān)內(nèi)容。
求大神講解一下里邊規(guī)則或者貼個(gè)博客地址。
2016-04-02
?明顯少了一個(gè)大括號(hào)
2016-03-31
window.open(url,"http://idcbgp.cn","_blank","width=400px,height=500px,menubai=no,toolbar=no");
改為
window.open(url,"_blank","width=400px,height=500px,menubai=no,toolbar=no");
試試?
2016-03-31
onclick="Wopen" 應(yīng)該是onclick="Wopen()"