這個(gè)問(wèn)題的代碼怎么寫呀
1、新窗口打開時(shí)彈出確認(rèn)框,是否打開
提示: 使用 if 判斷確認(rèn)框是否點(diǎn)擊了確定,如點(diǎn)擊彈出輸入對(duì)話框,否則沒(méi)有任何操作。
2、通過(guò)輸入對(duì)話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
3、打開的窗口要求,寬400像素,高500像素,無(wú)菜單欄、無(wú)工具欄。
1、新窗口打開時(shí)彈出確認(rèn)框,是否打開
提示: 使用 if 判斷確認(rèn)框是否點(diǎn)擊了確定,如點(diǎn)擊彈出輸入對(duì)話框,否則沒(méi)有任何操作。
2、通過(guò)輸入對(duì)話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
3、打開的窗口要求,寬400像素,高500像素,無(wú)菜單欄、無(wú)工具欄。
2016-11-18
舉報(bào)
2016-11-20
<!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 xuanz=confirm("是否確定打開新網(wǎng)址?"); // 新窗口打開時(shí)彈出確認(rèn)框,是否打開
?? if(xuanz==true)
??? {var wangzhi=prompt("請(qǐng)輸入您的網(wǎng)址:","http://idcbgp.cn");// 通過(guò)輸入對(duì)話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
??? window.open("wangzhi",'_blank','width=400,heigh=500,menubar=no,toolbar=no') ;
??? }//打開的窗口要求,寬400像素,高500像素,無(wú)菜單欄、無(wú)工具欄。
??? else{}
???
?? }
???
???
? </script>
?</head>
?<body>
?? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />
?</body>
</html>
2016-11-18
不用輸入判斷嗎 判斷輸入的網(wǎng)址是什么
2016-11-18
<script type="text/javascript">
????????var flag = window.confirm("是否打開窗口?");
????????if(flag){
????????????????window.open("http://idcbgp.cn/","_blank","width=400,height=500");
????????}
</script>