<!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?openwindow=confirm("是否打開");
????//?新窗口打開時彈出確認框,是否打開
?????if(openwindow==true)
????{
????????window.open('http://www.xianlaiwan.cn','_blank','width=400,height=500,menubar=no,toolbar=no');??
??
????}
????else
????{
???????document.write("bye");
????}
??}???
??</script>?
?</head>?
?<body>?
??<input?type="button"?value="新窗口打開網站"?onclick="openWindow()"?/>?
?</body>
</html>
2016-11-08
已經查明原因,剛剛才發現 ?,亂碼原因是meta標簽 ?charset設置不是gbk ?而是utf-8 ? 而且content 和charset每個都有自己單獨的內容 ?所以不用一起引號 ?最為主要的是?????第8行末尾是個中文分號,切記所有符號都要英文
2016-11-08
我的按源碼復制過去,按鈕那里的文字出現了亂碼,所以可能你的編碼方式不同,但是我完全抄你代碼,手敲之后可以打開,不存在問題!