求解,真的看不出哪錯了
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title>??
? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>? ?
? <script type="text/javascript">??
function openWindow(){? ??
? ? // 新窗口打開時彈出確認框,是否打開
? ? // 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ?
var message=confirm("是否需要打開網頁?");
if(message==true){
var site=prompt("請輸入網址:"," http://www.xianlaiwan.cn/");
if(site!=null){?
? ? ? window.open("http://www.xianlaiwan.cn/",'_blank','width=400,height=500,menubar=no,toolbar=no)
? }else{? alert("打開失敗");? }
? ??
}
else{alert("不需要打開網頁");}
}
openWindow();
</script>?
?</head>?
?<body>?
? <input type="button" value="新窗口打開網站" onclick="openWindow()" />?
?</body>
</html>
2018-09-19
window.open('http://www.xianlaiwan.cn/','_blank','width=400,height=500,menubar=no,toolbar=no')這里的冒號
2018-09-27
不應該是這樣嗎?難道是我寫錯了?
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>? ?
? <script type="text/javascript"> ?
?? ?
??? // 新窗口打開時彈出確認框,是否打開
??? // 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/
??? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
??? function add(){
??????? var add=confirm("是否打開?")
??????? if(add==true)
??????? {
??????? window.open('http://www.xianlaiwan.cn','_blank','width=400,height=500,left=0,menubar=no,toolbar=no,status=no,scrollbars=yes');
??????? }
??? }
? </script>
?</head>
?<body>
?? ?? <input type="button" value="新窗口打開網站" onclick="add()" />
?</body>
</html>
2018-09-19
兩個:http后面的是中文冒號,toolbar的no后面少一個單引號
2018-09-19
http后面的冒號你輸入法錯了,用的是中文。
2018-09-19
<!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 message=confirm("是否需要打開網頁?");
? if(message==true){
? ? ?var site=prompt("請輸入網址:",'');
? ? ?if(site){?
? ? ? ? window.open("http://www.xianlaiwan.cn/",'_blank','width=400,height=500,menubar=no,toolbar=no');
? ? ?}else{
? ? ? alert("打開失敗"); ?
? ? ?}
? }
} ?
</script>?
</head>?
<body>?
? <input type="button" value="新窗口打開網站" onclick="openWindow()" />?
</body>
</html>
2018-09-19
<!DOCTYPE html>
<html>
<head>
?<meta charset="UTF-8">
?<title>Document</title>
?<script type="text/javascript">?
??function openWindow(){???
????? // 新窗口打開時彈出確認框,是否打開????? // 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/????? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
????
???var message=confirm("是否需要打開網頁?");
???if(message==true){
????var site=prompt("請輸入網址:"," http://www.xianlaiwan.cn/");
????if(site!=null){
?????window.open("https://www.baidu.com/",'_blank','width=400,height=500,menubar=no,toolbar=no');
????}else{
?????alert("打開失敗");?
????}
???}
???else{
????alert("不需要打開網頁");
???}
??}
??openWindow();
?</script>
</head>
<body>
?<input type="button" value="新窗口打開網站" onclick="openWindow()" />
</body>
</html>
是? https ,不是 http 。測試的時候用的 百度 ,窗口 長寬高 無法規定。
2018-09-18
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title>??
? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>? ?
? <script type="text/javascript">??
function openWindow(){? ??
? ? // 新窗口打開時彈出確認框,是否打開
? ? // 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ?
var message=confirm("是否需要打開網頁?");
if(message==true){
var site=prompt("請輸入網址:"," http://www.xianlaiwan.cn/");
if(site!=null)
? {?
? ? ? window.open('http://www.xianlaiwan.cn/','_blank','width=400,height=500,menubar=no,toolbar=no')
? }
else
? {? alert("打開失敗");? }
}else{alert("不需要打開網頁");}
</script>?
?</head>?
?<body>?
? <input type="button" value="新窗口打開網站" onclick="openWindow()" />?
?</body>
</html>
2018-09-18
toolbar=no 后面缺個引號吧