為什么打不開慕課網(wǎng)站
function openWindow(){var open=confirm("請確認重新打開"); ? ? ? ?if(open==true){ ? ? ? ? ? ?var ope=prompt('輸入網(wǎng)址','http://idcbgp.cn/'); ? ? ? ? ? ?if(ope==true){window.open('http://idcbgp.cn/','width=400,height=200,menubar=no,toolbar=no') ? ? ? ? ? ?} ? ? ? ? } ? ? ? ?}為什么打不開慕課網(wǎng)
2017-03-16
去掉if(ope==true){}
window.open(ope,'width=400,height=200,menubar=no,toolbar=no'); ?
2017-03-16
那如果我想在prompt()界面點擊確定,打開慕課網(wǎng),怎么修改
2017-03-16
樓上正解。
2017-03-16
?var ope=prompt('輸入網(wǎng)址','http://idcbgp.cn/');這個句代碼得到的ope不是一個Boolean類型的值 ,所以你的if(ope==true)肯定是失敗的 。這個時候ope= 'http://idcbgp.cn/'; 所以你將if(ope==true)這個判定注釋掉就可以打開慕課網(wǎng)了