為什么我的實現不出來
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>? ?
? <script type="text/javascript"> ?
??? function rec(){
??????? var wopen = confirm("是否打開新窗口");
??????? if(wopen==true){
??????????? var nwindow=prompt("是否打開新網頁","http://www.xianlaiwan.cn");
??????????? if(nwindow!=null){
??????????????? window.open('http://www.xianlaiwan.cn','-blank','width=400px,height=500px,menubar=no,toolbar=no')
??????????? }
??????????? else{
??????????????? null
??????????? }
??????? }
??????? }
??????? else{
??????????? null
??????? }
?????? ?
??? }
?? ?
??? // 新窗口打開時彈出確認框,是否打開
??? // 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/
??? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
?? ?
?? ?
? </script>
?</head>
?<body>
?? ?? <input type="button" value="新窗口打開網站" onclick="rec()" />
?</body>
</html>
2019-01-02
window.open('http://www.xianlaiwan.cn','-blank','width=400px,height=500px,menubar=no,toolbar=no')
自己看下哪里錯了
2019-01-06
首先,-blacnk需改成_blank;其次,第一個else 后面多了一個}