為啥運(yùn)行不了?
? ?function openNew(){
? ? ? ?var con=confirm("是否打開");
? ? ? ?if(con==true){
? ? ? ? ? ?var pro=prompt("確定打開的網(wǎng)頁","http://idcbgp.cn/");
? ? ? ? ? ?if(pro!=null){
? ? ? ? ? ? ? ?window.open('http://idcbgp.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://idcbgp.cn/','_blank','width=400,height=500,menubar=no,toolbar=no');
? ? ? ? ? ?}
首先,判斷條件不對(duì)。pro不為空有兩種情況,一種為默認(rèn)網(wǎng)址,第二種為另外輸入的網(wǎng)址,而針對(duì)這兩種情況,你在window.open中打開的網(wǎng)址都是默認(rèn)的,與第二種明顯不符。
這是我改后的:
? ? ?Pro= prompt ("請(qǐng)輸入您要打開的網(wǎng)址","http://idcbgp.cn");
?
? ? ? window.open(Pro,'_black','width=400,height=500,menubar=no,toolbar=no');
? ? ? ? ?
2018-06-09
你的函數(shù)名字叫openNew , 給出的它給的代碼默認(rèn)openWindow
2018-06-08
然后記得手動(dòng)調(diào)用這個(gè)函數(shù),或者設(shè)置為window.onload
2018-06-08