我哪里錯了??
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>? ?
? <script type="text/javascript"> ?
??? function openwidow(){
??????? var miss=confirm("確認打開新窗口嗎?")
??????? if(miss==true){
??????????? var p = prompt("新窗口打開以下網址:","http://www.xianlaiwan.cn/");
??????????? window.open('http://www.xianlaiwan.cn','_blank','height=500,width=400,menubar=no,toolbar=no')
??????? }
??? </script>
?</head>
?<body>
?? ?? <input type="button" value="新窗口打開網站" onclick="openWindow()" />
?</body>
</html>
2016-08-19
首先是你的function 后面的openWindow ?字母打錯了 ?而且要區分大小寫,和下面onclick里面的openWindow必須要一致。
第二,少了個大括號 }?
2016-08-19
自己寫的東西不堪的嗎?你openwindow寫的一致么?window.open里的元素單引號呢,prompt有什么用