課程
/前端開發
/JavaScript
/JavaScript入門篇
求各位大神看看
2020-03-08
源自:JavaScript入門篇 2-7
正在回答
w大寫
你的confirm寫錯了,寫成comfirm了。
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title>??
? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>? ?
? <script type="text/javascript">??
? function openWindow(){
? ? // 新窗口打開時彈出確認框,是否打開
? ? var ok=confirm("是否打開")
? ? if(ok){
? ????? // 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/
? ? ? ? var website=prompt("請輸入你要打開的網址","http://www.xianlaiwan.cn");
? ? ? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ? ? ? if(website!=null){
? ? ? ? ? ? window.open(website,'_blank','width=400px,height=500px,menubar=no,toolbar=no');
? ? ? ? }
? ? }
? }
? </script>?
?</head>?
?<body>?
? <input type="button" value="新窗口打開網站" onclick="openWindow()" />?
?</body>
</html>
http://www.xianlaiwan.cn(從題目那里復制過來好像冒號是中文冒號)
openWindow函數的W是大寫的,你的是小寫,所以沒有引用到函數
一樣的啊 我按了還是沒反應
? ??
? ? // 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ? function openWindow(){
? ? ? ? var my=confirm('yes?');
? ? ? ? if(my){
? ? ? ? window.open('http://www.xianlaiwan.cn/','_blank','width=400px,height=500px');
? ? ? ? }else{
? ? ? ? ? ? alert('no')
你對比對比
原代碼不變,if(ok==true) --->if(ok),ok直接作為判斷條件
weixin_慕無忌8418846 提問者
直接對ok判斷
if(ok)
看海的街道 回復 weixin_慕無忌8418846 提問者
weixin_慕無忌8418846 提問者 回復 看海的街道
寶慕林5113234 回復 weixin_慕無忌8418846 提問者
舉報
JavaScript做為一名Web工程師的必備技術,本教程讓您快速入門
1 回答幫忙看下 點按鈕沒反應 是哪錯了嗎
2 回答哪位大神幫忙看看,點了按鈕沒反應,不知道哪里錯了。。
1 回答幫忙看一下哪里錯了?點擊按鈕半點反應都沒有。。
1 回答哪里錯了嗎 點擊按鈕沒反應
2 回答點擊按鈕沒反應,哪里錯了啊
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2020-06-17
w大寫
2020-03-12
你的confirm寫錯了,寫成comfirm了。
2020-03-09
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title>??
? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>? ?
? <script type="text/javascript">??
? function openWindow(){
? ? // 新窗口打開時彈出確認框,是否打開
? ? var ok=confirm("是否打開")
? ? if(ok){
? ????? // 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/
? ? ? ? var website=prompt("請輸入你要打開的網址","http://www.xianlaiwan.cn");
? ? ? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ? ? ? if(website!=null){
? ? ? ? ? ? window.open(website,'_blank','width=400px,height=500px,menubar=no,toolbar=no');
? ? ? ? }
? ? }
? }
? </script>?
?</head>?
?<body>?
? <input type="button" value="新窗口打開網站" onclick="openWindow()" />?
?</body>
</html>
2020-03-09
http://www.xianlaiwan.cn(從題目那里復制過來好像冒號是中文冒號)
2020-03-09
openWindow函數的W是大寫的,你的是小寫,所以沒有引用到函數
2020-03-08
一樣的啊 我按了還是沒反應
2020-03-08
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title>??
? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>? ?
? <script type="text/javascript">??
? ??
? ? // 新窗口打開時彈出確認框,是否打開
? ? // 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ? function openWindow(){
? ? ? ? var my=confirm('yes?');
? ? ? ? if(my){
? ? ? ? window.open('http://www.xianlaiwan.cn/','_blank','width=400px,height=500px');
? ? ? ? }else{
? ? ? ? ? ? alert('no')
? ? ? ? }
? ? }
? ??
? </script>?
?</head>?
?<body>?
? <input type="button" value="新窗口打開網站" onclick="openWindow()" />?
?</body>
</html>
你對比對比
2020-03-08
原代碼不變,if(ok==true) --->if(ok),ok直接作為判斷條件
2020-03-08
直接對ok判斷
if(ok)