課程
/前端開發(fā)
/JavaScript
/JavaScript入門篇
很迷茫,看了其他同學(xué)的代碼,都不太一樣,不知道怎么做才是正確的。
2016-06-03
源自:JavaScript入門篇 2-7
正在回答
<!DOCTYPE html><html>?<head>? <title> new document </title> ?? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>? ?? <script type="text/javascript"> ???? function lian(){??? var prc=confirm("是否打開彈窗?")?? ? // 新窗口打開時(shí)彈出確認(rèn)框,是否打開?? ??? ?if(prc==true){?? ??? ??? ?var add=prompt("請輸入:")?? // 通過輸入對話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/?? ??? ???? if(add!=null){?? ??? ??? ??? ?window.open("http://idcbgp.cn","_blank","width=600,height=400")?? ???????????????? //打開的窗口要求,寬600像素,高400像素,無菜單欄、無工具欄。?? ??? ??? ?} ?? ??? ?}}?? ?? </script> ?</head> ?<body> ?? ?? <input type="button" value="新窗口打開網(wǎng)站" onclick="lian()" /> ?</body></html>
起的名字不用管,隨便起的,看代碼就好
大姐的雙肩背 提問者
無瑕疵 回復(fù) 大姐的雙肩背 提問者
消息選擇框下面的if判斷打開網(wǎng)頁的函數(shù)名跟你上面定義的add名字不一樣,改過來就行了。if(add!=null)改成if(add)
舉報(bào)
JavaScript做為一名Web工程師的必備技術(shù),本教程讓您快速入門
3 回答編程練習(xí)這道題
1 回答這樣學(xué)習(xí)會不會被打?
1 回答編程練習(xí)題
2 回答練習(xí)題正解
3 回答JS練習(xí)問題
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)微信公眾號
2016-06-03
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>? ?
? <script type="text/javascript"> ?
??? function lian(){
??? var prc=confirm("是否打開彈窗?")?? ? // 新窗口打開時(shí)彈出確認(rèn)框,是否打開
?? ??? ?if(prc==true){
?? ??? ??? ?var add=prompt("請輸入:")?? // 通過輸入對話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
?? ??? ???? if(add!=null){
?? ??? ??? ??? ?window.open("http://idcbgp.cn","_blank","width=600,height=400")?? ?
??????????????? //打開的窗口要求,寬600像素,高400像素,無菜單欄、無工具欄。
?? ??? ??? ?}
?? ??? ?}
}
?? ?
? </script>
?</head>
?<body>
?? ?? <input type="button" value="新窗口打開網(wǎng)站" onclick="lian()" />
?</body>
</html>
起的名字不用管,隨便起的,看代碼就好
2016-06-03
消息選擇框下面的if判斷打開網(wǎng)頁的函數(shù)名跟你上面定義的add名字不一樣,改過來就行了。if(add!=null)改成if(add)