源程序
<html>
<head>
<script Language="JavaScript">
alert("第一个例子");
alert("欢迎");
</script>
</head>
</html>当在chrome,firefox中运行时出现乱码,
解决办法,加上<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />,改变编码方式
修改后源程序
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<html>
<head>
<script Language="JavaScript">
alert("第一个例子");
alert("欢迎");
</script>
</head>
</html>
本文介绍了在使用JavaScript创建的HTML页面中遇到编码乱码问题的解决方案,通过添加<meta>标签来改变编码方式,确保页面内容正确显示。
2071

被折叠的 条评论
为什么被折叠?



