為什么不顯示?
<!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 chen=confirm("是否打開網址");
? ? ? ? ?
? ? ? ? if(chen==true)
? ? ? ? {
? ? ? ? ? var wei=prompt("input url:","http://www.xianlaiwan.cn/")
? ? ? ? ?window.open('wei','_blank','width=400px,height=5oopx,menubar=no,toolbar=no')
? ? ? ? }
? ? }
? </script>?
?</head>?
?<body>?
? <input type="button" value="新窗口打開網站" onclick="openWindow()" />?
?</body>
</html>
2018-10-07
另外還有兩個問題,
1、默認網址http://www.xianlaiwan.cn/不能是中文冒號
2、window.open的第一個參數因為是變量名所以不能打引號
2018-10-07
函數名不對應,onclick="openWindow()" 和function openwindow()中w一個大寫一個小寫