課程
/前端開發(fā)
/JavaScript
/JavaScript入門篇
這個代碼有何問題,我實在找不出啦。
2016-10-30
源自:JavaScript入門篇 2-7
正在回答
哦,明白了。謝謝。
出現(xiàn)2個‘if’語句,后面一定跟上2個‘else’對應語句?
慕慕9086560
<!DOCTYPE html><html><head> ? ?<title> new document </title> ? ?<meta http-equiv="Content-Type" content="text/html; charset=gbk"/> ? ?<script type="text/javascript"> ? ? ? ?// 新窗口打開時彈出確認框,是否打開 ? ? ? ?// 通過輸入對話框,確定打開的網(wǎng)址,默認為 http://yifanck.cn/ ? ? ? ?//打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。 ? ? ? ?function openWindow() { ? ? ? ? ? ?var turn_on = confirm("確定打開網(wǎng)站?"); ? ? ? ? ? ?if (turn_on == true) { ? ? ? ? ? ? ? ?var news = prompt("確定打開本鏈接網(wǎng)址", "http//:yifanck.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>
注意:定義變量的時候,不要用new命名
web_東 提問者
第一個else后加一個if
舉報
JavaScript做為一名Web工程師的必備技術,本教程讓您快速入門
5 回答js代碼prompt問題,找不出毛病在哪了。。。
3 回答大神小神都看過來,為何我這個代碼死活運行不出來???找不到問題啊!!!
3 回答這是我的代碼,問題出在哪兒了?
1 回答請問我的代碼哪里出了問題?為何沒有效果
1 回答誰幫我看一下我這里哪里出錯了,實在找不出來…
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學習伙伴
掃描二維碼關注慕課網(wǎng)微信公眾號
2016-10-31
哦,明白了。謝謝。
2016-10-31
出現(xiàn)2個‘if’語句,后面一定跟上2個‘else’對應語句?
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">
? ? ? ?// 新窗口打開時彈出確認框,是否打開
? ? ? ?// 通過輸入對話框,確定打開的網(wǎng)址,默認為 http://yifanck.cn/
? ? ? ?//打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ? ? ?function openWindow() {
? ? ? ? ? ?var turn_on = confirm("確定打開網(wǎng)站?");
? ? ? ? ? ?if (turn_on == true) {
? ? ? ? ? ? ? ?var news = prompt("確定打開本鏈接網(wǎng)址", "http//:yifanck.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>
注意:定義變量的時候,不要用new命名
2016-10-30
第一個else后加一個if