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