課程
/前端開發(fā)
/JavaScript
/JavaScript入門篇
點了取消沒有彈出再見,打開的網(wǎng)頁也是空白的
2018-01-27
源自:JavaScript入門篇 2-7
正在回答
你的兩個else寫在一起了,把20,21,22往下面移下
苦心明
慕神7868388 提問者
<!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 open=confirm("是否打開新窗口");
? ? // 新窗口打開時彈出確認(rèn)框,是否打開
? ? if(open==true){
? ? ? ? var url=prompt("通過輸入對話框,確定打開的網(wǎng)址","http://yifanck.cn/");
? ? ? ? if(url!=null){
? ? // 通過輸入對話框,確定打開的網(wǎng)址,默認(rèn)為 http://yifanck.cn/
? ? ? ? window.open(url,"_blank","width=400px,height=500px,menubar=no,toolbar=no");
? ? ? ? }? ??
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ? ? ? else{
? ? ? ? ? ? alert("再見");
? ? ? ? }
? ? ? ??
? ? }
? ? else{
? ? ? ? alert("再見");
? ??
? }
? </script>?
?</head>?
?<body>?
? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
彌勒佛_
慕神7868388 提問者 回復(fù) 彌勒佛_
可以alert出ur看看,看是不是一個正確網(wǎng)址
舉報
JavaScript做為一名Web工程師的必備技術(shù),本教程讓您快速入門
2 回答打開新網(wǎng)址,點擊取消,不會出現(xiàn)空白網(wǎng)頁
2 回答是否打開網(wǎng)頁,點擊取消時,彈出了輸入網(wǎng)址的對話框
1 回答點取消會彈出空白頁
3 回答對話框彈出點否還是會彈出一個空的網(wǎng)頁,如何去除
1 回答為什么我的第一個確認(rèn)打開新網(wǎng)頁點擊“取消”后還會彈出“輸入對話框”啊
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
2018-02-02
你的兩個else寫在一起了,把20,21,22往下面移下
2018-01-27
<!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 open=confirm("是否打開新窗口");
? ? // 新窗口打開時彈出確認(rèn)框,是否打開
? ? if(open==true){
? ? ? ? var url=prompt("通過輸入對話框,確定打開的網(wǎng)址","http://yifanck.cn/");
? ? ? ? if(url!=null){
? ? // 通過輸入對話框,確定打開的網(wǎng)址,默認(rèn)為 http://yifanck.cn/
? ? ? ? window.open(url,"_blank","width=400px,height=500px,menubar=no,toolbar=no");
? ? ? ? }? ??
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ? ? ? else{
? ? ? ? ? ? alert("再見");
? ? ? ? }
? ? ? ??
? ? }
? ? else{
? ? ? ? alert("再見");
? ? }
? ??
? }
? </script>?
?</head>?
?<body>?
? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2018-01-27
可以alert出ur看看,看是不是一個正確網(wǎng)址