為什么我按鈕點了沒有作用???
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title>
? <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
? <script type="text/javascript">
???? function openWindow(){
????? var my=confirm("是否打開新窗口?");
????? if (my==true) {
??????? var ne = "請輸入網(wǎng)址","http://idcbgp.cn";
??????? if (ne!=null) {
????????? window.open{
????????? ne,'_blank','width=400,height=500,menubar=no,toolbar=no'
??????? };
??????? }
??????? else{
????????? alert("不能為空");
??????? }
????? };
????? else{
??????? document.write("z再見");
????? }
???? }
??? // 新窗口打開時彈出確認(rèn)框,是否打開
??? // 通過輸入對話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
??? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? </script>
?</head>
?<body>
????? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />
?</body>
</html>
2017-08-03
var ne = "請輸入網(wǎng)址","http://idcbgp.cn";
??????? if (ne!=null) {
????????? window.open{
????????? ne,'_blank','width=400,height=500,menubar=no,toolbar=no'
??????? };
這一段有問題.你的ne變成了兩個變量,.你兩個變量如何帶到url中呢?
2017-08-03
額 我改成var ne = prompt("請輸入網(wǎng)址","http://idcbgp.cn");了 但是點了還是沒有效果?
2017-08-03
?var ne = prompt("請輸入網(wǎng)址","http://idcbgp.cn");
應(yīng)該是這里出問題
2017-08-03
還有,if的大括號后面不能加上? ;
2017-08-03
還有就是你的window.open后面應(yīng)該是小括號.,你寫成了大括號