亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

打開窗口和關閉窗口為什么button按鈕沒反應??!

<!DOCTYPE html>

<html>

<head>

? ? <meta charset="UTF-8">

? ? <title>Document</title>

? ? <script type="text/javascript">

? ? ? ? function wopen(){

? ? ? ? ? ? ?var window=prompt("http://www.xianlaiwan.cn");

? ? ? ? ? ? ?if(window!=null){

? ? ? ? ? ? ? ? ? ? ?window.open('http://www.xianlaiwan.cn','_blank',width=400px,height=500px,menubar=no,toolbar=no);

? ? ? ? ? ? ?}else{

? ? ? ? ? ? ? ? alert("結束");

? ? ? ? ? ? ?}

? ? ? ? }


? </script>

?</head>

?<body>

? ? ? <input type="button" value="新窗口打開網站" onclick="wopen()" />

?</body>

</html>


正在回答

3 回答

變量不能與js方法名相同,?prompt("http://www.xianlaiwan.cn");?多余

0 回復 有任何疑惑可以回復我~

兩處錯誤

  1. var window=prompt("http://www.xianlaiwan.cn");?//變量不能與js方法名相同,可以命名為_window ,_w1,_w2,...;

  2. ??window.open('http://www.xianlaiwan.cn','_blank',width=400px,height=500px,menubar=no,toolbar=no);?//需要給?width=400px,height=500px,menubar=no,toolbar=no 添加引號 ' ' 或 " " , 統一用單引號或雙引號。

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

打開窗口和關閉窗口為什么button按鈕沒反應啊!

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號