請大神看一下我哪里錯了,謝謝。為什么打不開?
<!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 mywin=window.open("www.hao123.com");
? ? ? ? var pages = confirm("是否打開網(wǎng)頁?");
? ? ? ? ? if(pages == true){
? ? ? ? ? ? ? window.open('www.hao123.com','_blank','width=400,height=500,menubar=no,toolbar=no');
? ? ? ? ? ? ? alert("頁面已打開~");
? ? ? ? ? }
? ? ? ? ?else{
? ? ? ? ? ? ?mywin.close()
? ? ? ? ? ? ?alert("頁面已關(guān)閉");
? ? ? ? ?}
? ? }
? </script>?
?</head>?
?<body>?
? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2019-01-19
具體的說不太清楚 這是改正的 您參考一下 有錯誤的話希望理解!
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title>??
? <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>? ?
? <script type="text/javascript">??
? ? function openWindow()
? ? {
? ? ? ? var pages = confirm("是否打開網(wǎng)頁?");
? ? ? ? ? if(pages == true){
? ? ? ? ? ? window.open('https://www.hao123.com/','_blank','width=400,height=500,menubar=no,toolbar=no')
? ? ? ? ? }
? ? ? ? ?else{
? ? ? ? ? ? ? ? ? var mywin=window.open('https://www.hao123.com/','_blank','width=400,height=500,menubar=no,toolbar=no');
? ? ? ? ? ? ? ?mywin.close()
? ? ? ? ?}
? ? }
? </script>?
?</head>?
?<body>?
? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>