為啥運行不了?
? ?function openNew(){
? ? ? ?var con=confirm("是否打開");
? ? ? ?if(con==true){
? ? ? ? ? ?var pro=prompt("確定打開的網頁","http://www.xianlaiwan.cn/");
? ? ? ? ? ?if(pro!=null){
? ? ? ? ? ? ? ?window.open('http://www.xianlaiwan.cn/','_blank','width=400,height=500,menubar=no,toolbar=no');
? ? ? ? ? ?}
? ? ? ? ? ?else{
? ? ? ? ? ? ? ?alert("byeBye");
? ? ? ? ? ?}
? ? ? ?}
? ? ? ?else{
? ? ? ? ? ?alert("byeBye");
? ? ? ?}
? ?}
2018-06-08
?
??if(pro!=null){
? ? ? ? ? ? ? ?window.open('http://www.xianlaiwan.cn/','_blank','width=400,height=500,menubar=no,toolbar=no');
? ? ? ? ? ?}
首先,判斷條件不對。pro不為空有兩種情況,一種為默認網址,第二種為另外輸入的網址,而針對這兩種情況,你在window.open中打開的網址都是默認的,與第二種明顯不符。
這是我改后的:
? ? ?Pro= prompt ("請輸入您要打開的網址","http://www.xianlaiwan.cn");
?
? ? ? window.open(Pro,'_black','width=400,height=500,menubar=no,toolbar=no');
? ? ? ? ?
2018-06-09
你的函數名字叫openNew , 給出的它給的代碼默認openWindow
2018-06-08
然后記得手動調用這個函數,或者設置為window.onload
2018-06-08