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

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

為何執行的時候不打開窗口。window.open(url,這個url加引號打開的網址是 http://www.xianlaiwan.cn/code/url ,復制答案代碼也是打開http://www.xianlaiwan.cn/code/url

function openWindow()// 新窗口打開時彈出確認框,是否打開

? ?{

? ? ?var mymessage= confirm("是否打開窗口?")?

? ?if (mymessage==true)??

? ?{openurl();}

? ?else{}

? ?}

? ?

? ?function openurl()// 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/

? ?{

? ? ?var url = prompt("請輸入一個網址","http://www.xianlaiwan.cn/");??

? ? ?if(url=="http://www.xianlaiwan.cn/")

? ? ?{

? ? ? Wopen();

? ? ?}

? ? ?else

? ? ?{Wopen();}

? ?}

? ??

? ? function Wopen()

? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。

? ? {

? ? ? ?window.open(url,"_blank","toolbar=no, menubar=no, scrollbars=yes,? width=400, height=400") ;

? ? }


正在回答

6 回答

???? ???? function openWindow(){
?? ??? ??? ?// 新窗口打開時彈出確認框,是否打開
?? ???????? if(confirm("是否打開網頁")){
?? ??????? ??? ?//通過openW函數來獲取網址
?? ???????????? var url=openW();
?? ???????????? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄
?? ???????????? window.open(url,"width=400px","toolbar=no", "menubar=no","height=500px");
?? ???????? }
?? ???? }
?? ???? function openW(){
?? ??? ??? ?//將獲取的網址默認為:"http://www.xianlaiwan.cn/"
?? ???????? return prompt("請輸入網址","http://www.xianlaiwan.cn/");
??? }

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

慕運維2208324 提問者

非常感謝!
2017-11-11 回復 有任何疑惑可以回復我~

window.open(url),是默認打開“相對路徑+url"的,試一下window.open("http://"?+ url, arg1, arg2),

例如:

var arg_url = prompt("url", "http://"?+ url, "_blank", "width=400, height=500")

}else{

return;}

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

去掉兩個函數定義終于能通過了,可是輸入地址如果是www.baidu.com還是感覺有點怪,會打開頁面http://www.xianlaiwan.cn/code/www.baidu.com

--------

function openWindow()// 新窗口打開時彈出確認框,是否打開

? ?{

? ? ?var mymessage= confirm("是否打開窗口?")?

? ?if (mymessage==true)??

? ?{var url = prompt("請輸入一個網址","http://www.xianlaiwan.cn/");}

? ?window.open(url,"_blank","toolbar=no, menubar=no, scrollbars=yes,? width=400, height=400") ;

? ?}


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

function Wopen()
//打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
{
? ?window.open("url","_blank","toolbar=no, menubar=no, scrollbars=yes, ?width=400, height=400") ;
}

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

window.open(URL,"_blank","toolbar=no", "menubar=no","width=400", "height=400");//這里每一個屬性都需要用引號

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

慕運維2208324 提問者

在blank后面的可以一個引號括起來的
2017-11-11 回復 有任何疑惑可以回復我~

?? ? function openWindow(){
?? ????? var mymessage= confirm("是否打開窗口?")
?? ??? ? if (mymessage==true){
?? ??? ? ?? ?var URL=openurl();
?? ??? ? ?? ?Wopen();
?? ??? ? }
?? ? }
?? ? // 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/
? ??? ? function openurl(){
?? ??? ?? return prompt("請輸入一個網址","http://www.xianlaiwan.cn/");
?? ? }
??? function Wopen()
??? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
??? {
?????? window.open(URL,"_blank","toolbar=no", "menubar=no","width=400", "height=400");
??? }

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

慕運維2208324 提問者

最后打開的鏈接是:http://www.xianlaiwan.cn/code/function%20URL()%20%7B%20[native%20code]%20%7D
2017-11-11 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

為何執行的時候不打開窗口。window.open(url,這個url加引號打開的網址是 http://www.xianlaiwan.cn/code/url ,復制答案代碼也是打開http://www.xianlaiwan.cn/code/url

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

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

幫助反饋 APP下載

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

公眾號

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