這道題不會寫?
1、新窗口打開時彈出確認(rèn)框,是否打開
提示:?使用?if?判斷確認(rèn)框是否點擊了確定,如點擊彈出輸入對話框,否則沒有任何操作。
2、通過輸入對話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
3、打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
1、新窗口打開時彈出確認(rèn)框,是否打開
提示:?使用?if?判斷確認(rèn)框是否點擊了確定,如點擊彈出輸入對話框,否則沒有任何操作。
2、通過輸入對話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
3、打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
2019-04-14
舉報
2019-05-04
2019-04-14
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=unicode"/>? ?
? <script type="text/javascript"> ?
??? function openWindow(){
??? // 新窗口打開時彈出確認(rèn)框,是否打開
?? ?var mes = confirm("是否打開");
?? ?if(mes==1){
?? ??? ?var tar = prompt("請輸入要打開的網(wǎng)址:","http://idcbgp.cn/");
?? ??? ?if(tar!=null){
?? ??? ??? ?window.open(tar,'_blank','width=400,height=500,menubar=no,toolbar=no');
?? ??? ?}
?? ?}
?? ?else{
?? ??? ?alert("bye");
?? ?}
??? // 通過輸入對話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
??? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
??? }
? </script>
?</head>
?<body>
?? ?? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />
?</body>
</html>
2019-04-14
var IsRight = confirm("是否打開?")
if(IsRight == true){
window.open('http://idcbgp.cn','_blank','width=400,height=500,menubar=no,toolbar=no,status=yes,scrollbars=yes')
}