課程
/前端開發(fā)
/JavaScript
/JavaScript入門篇
這個(gè)代碼有何問題,我實(shí)在找不出啦。
2016-10-30
源自:JavaScript入門篇 2-7
正在回答
哦,明白了。謝謝。
出現(xiàn)2個(gè)‘if’語(yǔ)句,后面一定跟上2個(gè)‘else’對(duì)應(yīng)語(yǔ)句?
慕慕9086560
<!DOCTYPE html><html><head> ? ?<title> new document </title> ? ?<meta http-equiv="Content-Type" content="text/html; charset=gbk"/> ? ?<script type="text/javascript"> ? ? ? ?// 新窗口打開時(shí)彈出確認(rèn)框,是否打開 ? ? ? ?// 通過輸入對(duì)話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/ ? ? ? ?//打開的窗口要求,寬400像素,高500像素,無(wú)菜單欄、無(wú)工具欄。 ? ? ? ?function openWindow() { ? ? ? ? ? ?var turn_on = confirm("確定打開網(wǎng)站?"); ? ? ? ? ? ?if (turn_on == true) { ? ? ? ? ? ? ? ?var news = prompt("確定打開本鏈接網(wǎng)址", "http//:idcbgp.cn/"); ? ? ? ? ? ? ? ?alert(news) ? ? ? ? ? ? ? ?if (news == null) { ? ? ? ? ? ? ? ? ? ?window.open('website', 'blank', 'width=400px,height=500px,menubar=no,toolbar=no'); ? ? ? ? ? ? ? ?} else { ? ? ? ? ? ? ? ? ? ?alert("沒見到你,好傷心哦!"); ? ? ? ? ? ? ? ?} ? ? ? ? ? ?} else { ? ? ? ? ? ? ? ?document.write("打開失??!"); ? ? ? ? ? ?} ? ? ? ?} ? ?</script></head><body><input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" /></body></html>
注意:定義變量的時(shí)候,不要用new命名
web_東 提問者
第一個(gè)else后加一個(gè)if
舉報(bào)
JavaScript做為一名Web工程師的必備技術(shù),本教程讓您快速入門
5 回答js代碼prompt問題,找不出毛病在哪了。。。
3 回答大神小神都看過來,為何我這個(gè)代碼死活運(yùn)行不出來???找不到問題啊!!!
3 回答這是我的代碼,問題出在哪兒了?
1 回答誰(shuí)幫我看一下我這里哪里出錯(cuò)了,實(shí)在找不出來…
1 回答請(qǐng)問我的代碼哪里出了問題?為何沒有效果
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)
2016-10-31
哦,明白了。謝謝。
2016-10-31
出現(xiàn)2個(gè)‘if’語(yǔ)句,后面一定跟上2個(gè)‘else’對(duì)應(yīng)語(yǔ)句?
2016-10-30
<!DOCTYPE html>
<html>
<head>
? ?<title> new document </title>
? ?<meta http-equiv="Content-Type" content="text/html; charset=gbk"/>
? ?<script type="text/javascript">
? ? ? ?// 新窗口打開時(shí)彈出確認(rèn)框,是否打開
? ? ? ?// 通過輸入對(duì)話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
? ? ? ?//打開的窗口要求,寬400像素,高500像素,無(wú)菜單欄、無(wú)工具欄。
? ? ? ?function openWindow() {
? ? ? ? ? ?var turn_on = confirm("確定打開網(wǎng)站?");
? ? ? ? ? ?if (turn_on == true) {
? ? ? ? ? ? ? ?var news = prompt("確定打開本鏈接網(wǎng)址", "http//:idcbgp.cn/");
? ? ? ? ? ? ? ?alert(news)
? ? ? ? ? ? ? ?if (news == null) {
? ? ? ? ? ? ? ? ? ?window.open('website', 'blank', 'width=400px,height=500px,menubar=no,toolbar=no');
? ? ? ? ? ? ? ?} else {
? ? ? ? ? ? ? ? ? ?alert("沒見到你,好傷心哦!");
? ? ? ? ? ? ? ?}
? ? ? ? ? ?} else {
? ? ? ? ? ? ? ?document.write("打開失??!");
? ? ? ? ? ?}
? ? ? ?}
? ?</script>
</head>
<body>
<input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />
</body>
</html>
注意:定義變量的時(shí)候,不要用new命名
2016-10-30
第一個(gè)else后加一個(gè)if