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