有关document.charset的问题? document.charset 这个是设置字符集的---对ALERT无效!alert 输出原样! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <a href="javascript:test('中文')">中文</a>which charset you used when you save the HTML file? alert(str);//alert会把str照原样输出,与字符集没有关系 <html><head><title> New Document </title><meta http-equiv="content-type" content="text/html; charset=gbk"></head><script>function test(s){alert(document.charset);alert(s);document.charset="utf-8";alert(document.charset);alert(s);document.getElementById("d").innerHTML = s;document.getElementById("d1").innerText = s;}</script><body><a href="javascript:test('中文')">中文</a><div id="d"></div><div id="d1"></div></body></html>就算不用alert,将s的值赋到div上,也还是gbk字符集的,而不是utf-8字符集的,我的用意是希望通过document.charset来改变以后的字符输出由js改变,不用meta来指定! 把你的html用editplus另存为utf-8 jquery.get的非常郁闷的一件事 JS获取checkBox的值,提示说没有Checked这个属性,奇怪了 外部JS文件怎样调试,进而找出错误啊??? 如何用一个比较简单的方法将一个表的第一行放到最后 如何实现对隐藏域取值的引用?? mysql连接java Ext.ux.tree.TreeGrid的默认排序如何改为中文? 有点难度问题,高手请进 在(实现满位tab,请指教 )一贴中答应加分的来这里拿 如何取得表单中多选项与单选项的值? 关于文本框无法显示的问题 在这段 JS 代码中 如何加如 onclick 条件
which charset you used when you save the HTML file?
<head>
<title> New Document </title>
<meta http-equiv="content-type" content="text/html; charset=gbk">
</head>
<script>
function test(s){
alert(document.charset);
alert(s);
document.charset="utf-8";
alert(document.charset);
alert(s);
document.getElementById("d").innerHTML = s;
document.getElementById("d1").innerText = s;
}
</script><body>
<a href="javascript:test('中文')">中文</a>
<div id="d"></div>
<div id="d1"></div>
</body>
</html>就算不用alert,将s的值赋到div上,也还是gbk字符集的,而不是utf-8字符集的,我的用意是希望通过document.charset来改变以后的字符输出由js改变,不用meta来指定!