是不是哪里錯(cuò)了?
function openWindow(){
? ? var new=confirm("是否打開");
? ? // 新窗口打開時(shí)彈出確認(rèn)框,是否打開
? ? if(new==true){
? ? ? ? // 通過輸入對(duì)話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
? ? ? ? var yes=prompt("確定打開","http://idcbgp.cn");
? ? }if(yes){
? ? ? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ? ? ? window.open(yes,'_blank,width=400,height=500,menubar=no,toolbar=no');
? ? }else{
? ? ? ? alert("see you ");
? ? }
? ? ? ??
總感覺哪里怪怪?
2016-02-28
?if(new==true)里面應(yīng)該將其他代碼包裹進(jìn)去,還有window.open()有三個(gè)參數(shù),每個(gè)參數(shù)都是一個(gè)字符串,你傳入了兩個(gè)字符串,把'_blank'和'width=400,height=500,menubar=no,toolbar=no'混在一起了。
2016-02-28
prompt的返回值不是boolean,所以不能if(yes)
2016-02-28
if(confirm("是否打開")){
var url=prompt("請(qǐng)輸入網(wǎng)址:","http://www,imooc.com");
window.open(url,'_blank','width=400,height=500,menubar=no,toolbar=no');
}