為什么“是否打開新窗口”這個窗口彈不出來?
<!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 s=confirm("是否打開新窗口?");
??? // 新窗口打開時彈出確認框,是否打開
??????? if(s==true){
??????????? window.open('http://www.xianlaiwan.cn/','_blank','menubar=no,toolbar=no,width=400,height=500');
??????? }
??? // 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/
??????? else{
??????????? alert("歡迎再來!");
??????? }
???????
??? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
??? }
???
? </script>
?</head>
?<body>
?? <input type="button" value="新窗口打開網站" onclick="openWindow()" />
?</body>
</html>
2019-03-13
你的函數名大小問題
2019-03-12
有點粗心了,點擊事件所傳遞的函數名寫錯了,把大寫的W改回你所定義的小寫w就可以了“onclick="openWindow()"”=》“onclick="openwindow()"”。
2019-03-11
點擊新窗口打開網站按鈕