這為什么輸出不出來
<!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 th=confirm("是否打開網頁");
// 新窗口打開時彈出確認框,是否打開
if(th==true){
var zh=prompt("請輸入網址";"www.baidu.com");
// 通過輸入對話框,確定打開的網址,默認為 http://idcbgp.cn/
if(zh!=null){
window.open(zh,"_blank",'width=400px,height=500px,menubar=no,toolbar=no')
}
?//打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
else{alert("ok")}
}
? ? else{alert("ok")}
? ?
??
? ?}?
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網站" onclick="openWindow()" />?
?</body>
</html>
2019-04-19
prompt消息對話框中間的傳倆個參數的話,格式是逗號而不是分號,還有個是通過open打開網站時,網址前需要加http://,因為http是超文本傳輸協議。