課程
/前端開發(fā)
/JavaScript
/JavaScript入門篇
救救孩子吧,為什么連對話框都不彈出了 而去掉function那行就可以?
2020-08-13
源自:JavaScript入門篇 2-7
正在回答
message==true 去掉一個=試試
<html>
?<head>
? <title> new document </title>??
? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>? ?
? <script type="text/javascript">??
? ??
? ? // 新窗口打開時彈出確認(rèn)框,是否打開
? ? // 通過輸入對話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ? function openWindow(){
? ? ? ? var win=confirm("是否打開?");
? ? ? ? if(win==true){
? ? ? ? ? ? var web=prompt("確認(rèn)打開網(wǎng)址?"," http://idcbgp.cn/");
? ? ? ? ? ? if(web!=null){
? ? ? ? ? ? window.open(web,'_blank','width=400px,height=500px,menubar=no,toolbar=no');
? ? ? ? ? ? }
? ? ? ? }
? ? }
? </script>?
?</head>?
?<body>?
? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
我這樣可以運行呀,你試試重新輸入一下或者換個網(wǎng)站試試
舉報
JavaScript做為一名Web工程師的必備技術(shù),本教程讓您快速入門
3 回答為什么我不加function也能彈出對話框?
4 回答為什么不彈出對話框
4 回答為什么彈不出對話框?
1 回答為什么彈不出對話框?
2 回答為什么彈不出對話框?
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)微信公眾號
2020-08-23
message==true 去掉一個=試試
2020-08-13
<html>
?<head>
? <title> new document </title>??
? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>? ?
? <script type="text/javascript">??
? ??
? ? // 新窗口打開時彈出確認(rèn)框,是否打開
? ? // 通過輸入對話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ? function openWindow(){
? ? ? ? var win=confirm("是否打開?");
? ? ? ? if(win==true){
? ? ? ? ? ? var web=prompt("確認(rèn)打開網(wǎng)址?"," http://idcbgp.cn/");
? ? ? ? ? ? if(web!=null){
? ? ? ? ? ? window.open(web,'_blank','width=400px,height=500px,menubar=no,toolbar=no');
? ? ? ? ? ? }
? ? ? ? }
? ? }
? ??
? </script>?
?</head>?
?<body>?
? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
我這樣可以運行呀,你試試重新輸入一下或者換個網(wǎng)站試試