為何執(zhí)行的時候不打開窗口。window.open(url,這個url加引號打開的網(wǎng)址是 http://idcbgp.cn/code/url ,復制答案代碼也是打開http://idcbgp.cn/code/url
function openWindow()// 新窗口打開時彈出確認框,是否打開
? ?{
? ? ?var mymessage= confirm("是否打開窗口?")?
? ?if (mymessage==true)??
? ?{openurl();}
? ?else{}
? ?}
? ?
? ?function openurl()// 通過輸入對話框,確定打開的網(wǎng)址,默認為 http://idcbgp.cn/
? ?{
? ? ?var url = prompt("請輸入一個網(wǎng)址","http://idcbgp.cn/");??
? ? ?if(url=="http://idcbgp.cn/")
? ? ?{
? ? ? Wopen();
? ? ?}
? ? ?else
? ? ?{Wopen();}
? ?}
? ??
? ? function Wopen()
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ? {
? ? ? ?window.open(url,"_blank","toolbar=no, menubar=no, scrollbars=yes,? width=400, height=400") ;
? ? }
2017-11-11
???? ???? function openWindow(){
?? ??? ??? ?// 新窗口打開時彈出確認框,是否打開
?? ???????? if(confirm("是否打開網(wǎng)頁")){
?? ??????? ??? ?//通過openW函數(shù)來獲取網(wǎng)址
?? ???????????? var url=openW();
?? ???????????? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄
?? ???????????? window.open(url,"width=400px","toolbar=no", "menubar=no","height=500px");
?? ???????? }
?? ???? }
?? ???? function openW(){
?? ??? ??? ?//將獲取的網(wǎng)址默認為:"http://idcbgp.cn/"
?? ???????? return prompt("請輸入網(wǎng)址","http://idcbgp.cn/");
??? }
2019-03-10
window.open(url),是默認打開“相對路徑+url"的,試一下window.open("http://"?+ url, arg1, arg2),
例如:
var arg_url = prompt("url", "http://"?+ url, "_blank", "width=400, height=500")
}else{
return;}
2017-11-11
去掉兩個函數(shù)定義終于能通過了,可是輸入地址如果是www.baidu.com還是感覺有點怪,會打開頁面http://idcbgp.cn/code/www.baidu.com
--------
function openWindow()// 新窗口打開時彈出確認框,是否打開
? ?{
? ? ?var mymessage= confirm("是否打開窗口?")?
? ?if (mymessage==true)??
? ?{var url = prompt("請輸入一個網(wǎng)址","http://idcbgp.cn/");}
? ?window.open(url,"_blank","toolbar=no, menubar=no, scrollbars=yes,? width=400, height=400") ;
? ?}
2017-11-11
function Wopen()
//打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
{
? ?window.open("url","_blank","toolbar=no, menubar=no, scrollbars=yes, ?width=400, height=400") ;
}
2017-11-11
window.open(URL,"_blank","toolbar=no", "menubar=no","width=400", "height=400");//這里每一個屬性都需要用引號
2017-11-11
?? ? function openWindow(){
?? ????? var mymessage= confirm("是否打開窗口?")
?? ??? ? if (mymessage==true){
?? ??? ? ?? ?var URL=openurl();
?? ??? ? ?? ?Wopen();
?? ??? ? }
?? ? }
?? ? // 通過輸入對話框,確定打開的網(wǎng)址,默認為 http://idcbgp.cn/
? ??? ? function openurl(){
?? ??? ?? return prompt("請輸入一個網(wǎng)址","http://idcbgp.cn/");
?? ? }
??? function Wopen()
??? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
??? {
?????? window.open(URL,"_blank","toolbar=no", "menubar=no","width=400", "height=400");
??? }