<!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 sure=confirm("请问是否打开"); //确认框
if(sure==true){
var home=prompt("请输入您要打开的网址",""); //输入打开的网址
window.open(home,"width=400px,height=500px","_blank","menubar=no,toolbar=no"); //打开输入的新窗口
sure_one=confirm("是否关闭网址");
if(home!=NULL){
home.close();
}
}else{
document.write("Thanks For You! ");
}
}
</script>
</head>
<body>
<input type="button" value="新窗口打开网站" onclick="openWindow()" />
</body>
</html>
charset="utf-8"
window.open(home,"_blank""width=400px,height=500px,menubar=no,toolbar=no");
charset=UTF-8 这样就不会乱码了
乱码是吗?
<head>下面加一句,
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">