為什么第二步的輸入框的字沒法自定義了?
代碼如下:
function openWindow(){
? ? var conf=confirm("是否要打開");
? ? if(conf==true)// 新窗口打開時彈出確認(rèn)框,是否打開
{var typ=prompt("輸入網(wǎng)址","啊啊啊啊");
? ??
}
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ? if(conf==false){
? ? ? ??
? ? }
}
此時第二步輸入框內(nèi)是空的
2018-09-17
我直接復(fù)制粘貼了你的代碼 ,貌似你的?var typ=prompt("輸入網(wǎng)址","啊啊啊啊");這條語句后的分號是中文的分號,所以該代碼沒有執(zhí)行,我修改之后是沒有問題的。
2018-09-17
你的分號是中文分號
2018-09-17
function openWindow(){
? ? ? var conf=confirm("是否要打開");
? ? ? if(conf==true)// 新窗口打開時彈出確認(rèn)框,是否打開
? ? ? {var typ=prompt("輸入網(wǎng)址","啊啊啊啊");
? ? ? ? if(typ!=null){
? ? ? ? ? window.open("www.baidu.com");
? ? ? ? }
? ? ? ? else{alert("拜拜")};
? ? ? }
? ? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ? ? else{
? ? ? ? ? alert("拜拜");
? ? ? }
? ? }
建立在你的基礎(chǔ)上幫你改的