這樣的代碼是不是錯誤的?但還是正確運行,只是會跳出兩個提示框
<script type="text/javascript"> ? ? ?
? ? ?alert("是否確認要打開新頁面?");
? ? ?window.open("http://www.xianlaiwan.cn"); ? window.open("http://www.xianlaiwan.cn","_blank","width=400,hright=500");
</script>?
<script type="text/javascript"> ? ? ?
? ? ?alert("是否確認要打開新頁面?");
? ? ?window.open("http://www.xianlaiwan.cn"); ? window.open("http://www.xianlaiwan.cn","_blank","width=400,hright=500");
</script>?
2019-03-19
舉報
2019-03-19
你的高height寫錯了
你這樣是會彈出提示,但是沒有實現他的功能要求呀
可以參考一下我的
<!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 a=confirm("是否打開網頁");
? ? ? ? if(a==true){
? ? ? ? ? ? var b=prompt("請輸入要打開的網頁","http://www.xianlaiwan.cn");
? ? ? ? ? ? if(b==null){
? ? ? ? ? ? ? ? document.write('那沒事了');
? ? ? ? ? ? }
? ? ? ? ? ? else{
? ? ? ? ? ? ? ? window.open(b,'_blank','height=500,width=400,menubar=no,toolbar=no')
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? else{
? ? ? ? ? ? document.write('那沒事了');
? ? ? ? }
? ? }
? ? // 新窗口打開時彈出確認框,是否打開
? ? // 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ??
? ??
? </script>?
?</head>?
?<body>?
? <input type="button" value="新窗口打開網站" onclick="openWindow()" />?
?</body>
</html>
2019-03-20
2019-03-19
代碼是沒錯,對這個語句alert("是否確認要打開新頁面?");無倫如何都會彈出兩個網頁,高的英語寫錯了,
2019-03-19
不是,你寫了兩個彈框它就會彈出兩個,刪除一個就會彈出一個了