求大神看看為啥點按鈕沒反應(yīng)?
function openwindow(){
? ? var test=confirm("是否打開?");
? ? ? ? if(test==true);
? ? ? ? {opensite=prompt("請輸入網(wǎng)址","http://idcbgp.cn/");
? ? ? ? ?if(opensite!=null)
? ? ? ? ?{window.open=('http://idcbgp.cn/','width=400,hight=500,menutool=no,toolbar=no');}
? ? ? ? ?else {alert("bye");}
? ? ? ? else{document.write("無法打開!");}
? ? }// 新窗口打開時彈出確認框,是否打開
? ? // 通過輸入對話框,確定打開的網(wǎng)址,默認為 http://idcbgp.cn/
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ??
? ??
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
2016-06-29
就是這樣
2016-06-29
1、函數(shù)名與之前的不一致,應(yīng)為openWindow();
2、少了一個大括號
3、?opensite=promp();應(yīng)該用var??opensite=promp();
2016-06-29
if(test==true);這里的分號是多余的吧,好多錯誤,我的代碼是這樣的:
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> ??
? <script type="text/javascript"> ?
var mymessage=confirm("是否打開");
? ? // 新窗口打開時彈出確認框,是否打開
? ? function openWindow(){
window.open('http://idcbgp.cn','_blank','width=400,height=500,menubar=no,toolbar=no, status=no,scrollbars=yes')}
? ? // 通過輸入對話框,確定打開的網(wǎng)址,默認為 http://idcbgp.cn/
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。?
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2016-06-29
方法名不一致
2016-06-29
onclick="openwindow()" ?方法名都寫錯了