點(diǎn)擊按鈕一直沒有反應(yīng),求大神指教存在的問題
function openWindow(){
? ? ? ? var confirmresult=confirm("是否打開新窗口?");
? ? ? ? if (confirmresult==true)
? ? ? ? {
? ? ? ? ? ? prompt("請確定打開的網(wǎng)址:","http://idcbgp.cn/");
? ? ? ? ? ? window.open('http://idcbgp.cn/','_blank','width=400,height=500,menubar=no,toolbar=no');
? ? ? ? }
? ? ? ? else
? ? ? ? {
? ? ? ? ? ? ;
? ? ? ? }
? ? }
2016-07-16
這里中間的逗號改用英文狀態(tài)下輸入。
else語句要有內(nèi)容,要不就不要這語句也行。
2016-07-16
? ?if (confirm("是否打開新窗口?"))
? ? ? ? {
? ? ? ? ? ? prompt("請確定打開的網(wǎng)址:","http://idcbgp.cn/");
? ? ? ? ? ? window.open('http://idcbgp.cn/','_blank','width=400,height=500,menubar=no,toolbar=no');
? ? ? ? }
你可以直接這么寫就好。
2016-07-16
? function openWindow(){
? ? // 新窗口打開時(shí)彈出確認(rèn)框,是否打開
? ? var message=confirm("是否打開網(wǎng)址?");
? ? // 通過輸入對話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
? ? if (message==true){
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ? ? ? var net=prompt("請輸入網(wǎng)址:","http://idcbgp.cn/");
? ? ? ? if(net != null){
? ? ? ? ? ? window.open(net)
? ? ? ? }
? ? }
? ? }
這是我的代碼
2016-07-16
prompt前定義一個(gè)變量,如var a = prompt("請確定打開的網(wǎng)址:","http://idcbgp.cn/");
下面直接寫成window.open(a,'_blank','width=400,height=500,menubar=no,toolbar=no');即可。else 可不加,你自己試下。希望能幫到你