<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>document.write</title>
<script type="text/javascript">
var mystr="我是";
var mychar="JavaScript";
document.write(mychar+"<br>");
document.write(mystr+mychar+"的忠实粉丝!");
</script>
</head>
<body>
</body>
</html>
不是编码集问题。
而是因为你在“粉丝”后边的括号,是中文括号。换成英文的即可。亲测有效,把那半边括号换成英文的之后,在火狐浏览器上正常显示。
修改后↓↓↓↓
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>document.write</title>
<script type="text/javascript">
var mystr="我是";
var mychar="JavaScript";
document.write(mychar+"<br>");
document.write(mystr+mychar+"的忠实粉丝!");
</script>
</head>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>document.write</title>
<script type="text/javascript">
var mystr="我是";
var mychar="JavaScript";
document.write(mychar+"<br>");
document.write(mystr+mychar+"的忠实粉丝!");
</script>
</head>
<body>
</body>
</html>
是不是编码集的问题,你把<meta>标签最后的utf-8改成gbk试试?