課程
/前端開發(fā)
/JavaScript
/JavaScript入門篇
運(yùn)行后,這樣到最后,然后打開新窗口會(huì)失敗,是顯示那種找不到網(wǎng)頁的那樣
2016-11-14
源自:JavaScript入門篇 2-7
正在回答
?web=prompt("是否打開慕課網(wǎng)","http://idcbgp.cn");
愛3 提問者
我照著寫的,但問什么“確定”按鍵要雙擊才能打開新的窗口,單擊沒反應(yīng)喃,求解
<script type="text/javascript">function Wopen(){?var bb=confirm("打開新的窗口");??if(bb==true)??{???window.open("http://idcbgp.cn","_blank","width=400,height=500,menubar=no,status=no,scrollbars=yes")??}??else??{???document.write("取消操作");??}}</script></head>
<body><input type="button" value="新窗口打開網(wǎng)站" ondblclick="Wopen()" /></body>
<!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 message=confirm("是否打開新窗口");
? ? // 新窗口打開時(shí)彈出確認(rèn)框,是否打開
? ? ?if(message==true)
? ? ?{
? ? ?var str = prompt("請(qǐng)輸入要打開的網(wǎng)址");
? ? ?window.open(str,'width=400,height=500,menubar=no,toolbar=no');
? ? ?}
? ? // 通過輸入對(duì)話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ??
? ? }
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
愛3 提問者 回復(fù) 王丫頭
舉報(bào)
JavaScript做為一名Web工程師的必備技術(shù),本教程讓您快速入門
1 回答為什么不能打開新窗口?
4 回答為什么不能打開新窗口
2 回答為什么打不開新窗口
4 回答為什么新窗口打不開
4 回答為什么打不開新窗口?
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2016-11-14
?web=prompt("是否打開慕課網(wǎng)","http://idcbgp.cn");
2016-11-17
<script type="text/javascript">
function Wopen()
{
?var bb=confirm("打開新的窗口");
??if(bb==true)
??{
???window.open("http://idcbgp.cn","_blank","width=400,height=500,menubar=no,status=no,scrollbars=yes")
??}
??else
??{
???document.write("取消操作");
??}
}
</script>
</head>
<body>
<input type="button" value="新窗口打開網(wǎng)站" ondblclick="Wopen()" />
</body>
2016-11-14
<!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 message=confirm("是否打開新窗口");
? ? // 新窗口打開時(shí)彈出確認(rèn)框,是否打開
? ? ?if(message==true)
? ? ?{
? ? ?var str = prompt("請(qǐng)輸入要打開的網(wǎng)址");
? ? ?window.open(str,'width=400,height=500,menubar=no,toolbar=no');
? ? ?}
? ? // 通過輸入對(duì)話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ??
? ? }
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>