課程
/前端開(kāi)發(fā)
/JavaScript
/JavaScript入門篇
如圖,請(qǐng)教大佬
2019-10-20
源自:JavaScript入門篇 2-7
正在回答
沒(méi)錯(cuò) 是冒號(hào)的問(wèn)題emmm
你應(yīng)該先打開(kāi)提示框confirm,然后判斷,如果為true再打開(kāi)對(duì)話框prompt,prompt中如果不為空,在window.open,參數(shù)url可以自己定義一個(gè)變量去接受你收入的網(wǎng)址,如果confirm中為false,則直接打開(kāi)默認(rèn)的網(wǎng)址
? ? ? ? function openWindow(){
? ? ? ? var url;
? ? ? ? var newWindow=confirm("是否打開(kāi)對(duì)話框");
? ? ? ? if(newWindow==true){
? ? ? ? ? ? url=prompt("請(qǐng)輸入你要打開(kāi)的網(wǎng)址")
? ? ? ? ? ? if(url!=null){
? ? ? ? ? ? ? ? window.open(url,'_blank','width=400,height=500');
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? else{
? ? ? ? ? ? window.open('http://yifanck.cn','_blank','width=500px,height=200px');
? ? ? ??
? ? }
第8行? 冒號(hào)改成英文模式下輸出
舉報(bào)
JavaScript做為一名Web工程師的必備技術(shù),本教程讓您快速入門
2 回答網(wǎng)頁(yè)一直跳轉(zhuǎn)到慕課網(wǎng)首頁(yè)
1 回答怎么跳轉(zhuǎn)不出新頁(yè)面
4 回答最后跳轉(zhuǎn)網(wǎng)頁(yè)怎么不能跳到prompt()里面輸入的網(wǎng)址呢???
3 回答點(diǎn)擊取消還是跳轉(zhuǎn)了網(wǎng)頁(yè)
2 回答window.open()頁(yè)面跳轉(zhuǎn)疑惑
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購(gòu)課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2019-10-24
沒(méi)錯(cuò) 是冒號(hào)的問(wèn)題emmm
2019-10-22
你應(yīng)該先打開(kāi)提示框confirm,然后判斷,如果為true再打開(kāi)對(duì)話框prompt,prompt中如果不為空,在window.open,參數(shù)url可以自己定義一個(gè)變量去接受你收入的網(wǎng)址,如果confirm中為false,則直接打開(kāi)默認(rèn)的網(wǎng)址
? ? ? ? function openWindow(){
? ? ? ? var url;
? ? ? ? var newWindow=confirm("是否打開(kāi)對(duì)話框");
? ? ? ? if(newWindow==true){
? ? ? ? ? ? url=prompt("請(qǐng)輸入你要打開(kāi)的網(wǎng)址")
? ? ? ? ? ? if(url!=null){
? ? ? ? ? ? ? ? window.open(url,'_blank','width=400,height=500');
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? else{
? ? ? ? ? ? window.open('http://yifanck.cn','_blank','width=500px,height=200px');
? ? ? ? }
? ? ? ??
? ? }
2019-10-21
第8行? 冒號(hào)改成英文模式下輸出