我哪里錯(cuò)了??
<!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("確認(rèn)打開新窗口嗎?")
??????? if(miss==true){
??????????? var p = prompt("新窗口打開以下網(wǎng)址:","http://idcbgp.cn/");
??????????? window.open('http://idcbgp.cn','_blank','height=500,width=400,menubar=no,toolbar=no')
??????? }
??? </script>
?</head>
?<body>
?? ?? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />
?</body>
</html>
2016-08-19
首先是你的function 后面的openWindow ?字母打錯(cuò)了 ?而且要區(qū)分大小寫,和下面onclick里面的openWindow必須要一致。
第二,少了個(gè)大括號(hào) }?
2016-08-19
自己寫的東西不堪的嗎?你openwindow寫的一致么?window.open里的元素單引號(hào)呢,prompt有什么用