社区
JavaScript
帖子详情
在英文操作系统中javaScript文件的汉字显示为乱码?怎解?50分!!!!
阿博
2002-10-10 07:39:46
我的程序结构为:
在HTML中嵌入一个javaScript文件,其中有一个方法是金额大写转换。
如:在文本框中输入110
则在另在一文本框中显示:壹佰壹拾元整。
----
经测试,如果为中文操作系统,IE显示是好的。如果为英文操作系统,IE虽然安装了中文码(GB2312),大写部分显示是乱码。(如果上其它中文网站,显示是好的)。
请高手指点。
...全文
161
5
打赏
收藏
在英文操作系统中javaScript文件的汉字显示为乱码?怎解?50分!!!!
我的程序结构为: 在HTML中嵌入一个javaScript文件,其中有一个方法是金额大写转换。 如:在文本框中输入110 则在另在一文本框中显示:壹佰壹拾元整。 ---- 经测试,如果为中文操作系统,IE显示是好的。如果为英文操作系统,IE虽然安装了中文码(GB2312),大写部分显示是乱码。(如果上其它中文网站,显示是好的)。 请高手指点。
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
5 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
阿博
2002-10-10
打赏
举报
回复
OK。不错。如果我要中文简体的写法,改为相应的内码即可??
阿博
2002-10-10
打赏
举报
回复
非常感谢!!!!我马上试试。先给分再试:)
孟子E章
2002-10-10
打赏
举报
回复
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<script type="text/javascript">
<!--
var TranscriptionsLayer;
var snum = new Array();
snum[0]='\u3007<br>';
snum[1]='\u4e00<br>';
snum[2]='\u4e8c<br>';
snum[3]='\u4e09<br>';
snum[4]='\u56db<br>';
snum[5]='\u4e94<br>';
snum[6]='\u516d<br>';
snum[7]='\u4e03<br>';
snum[8]='\u516b<br>';
snum[9]='\u4e5d<br>';
var
sten = new Array();
sten[0]='';
sten[1]='\u5341<br>';
sten[2]='\u5eff<br>';
sten[3]='\u5345<br>';
sten[4]='\u534c<br>';
sten[5]='\u4e94<br>\u5341<br>';
var
jfancy = new Array();
jfancy[0]='';
jfancy[1]='\u58f1<br>';
jfancy[2]='\u5f10<br>';
jfancy[3]='\u53c2<br>';
jfancy[4]='\u8086<br>';
jfancy[5]='\u4f0d<br>';
jfancy[6]='\u9678<br>';
jfancy[7]='\u67d2<br>';
jfancy[8]='\u634c<br>';
jfancy[9]='\u7396<br>';
jfancy[10]='\u62fe<br>';
hanzero='\u96f6<br>';
hanht='\u6642<br>';
hanmt='\u5206<br>';
hanst='\u79d2<br>';
function givehan(inwhat, inhow) {
var outwhat = '';
if (inwhat == 0)
{
if (inhow == 1)
{outwhat = snum[0] + snum[0]}
else
{outwhat = hanzero}
}
else
{
if (inhow == 0) {
var
outbegin = '';
var
outmiddle = '';
var
outend = '';
if (inwhat >= 20)
{outbegin = snum[Math.floor(inwhat / 10)]};
if (inwhat >= 10)
{outmiddle = sten[1]};
if (inwhat % 10 != 0)
{outend = snum[inwhat % 10]};
outwhat = outbegin + outmiddle + outend;
};
if (inhow == 1)
{outwhat = snum[Math.floor(inwhat / 10)] + snum[inwhat % 10]};
if (inhow == 2) {
var
outend = '';
var
outbegin = sten[Math.floor(inwhat / 10)];
if (inwhat % 10 != 0)
{outend = snum[inwhat % 10]};
outwhat = outbegin + outend;
};
if (inhow==3) {
var
outbegin = '';
var
outmiddle = '';
var
outend = '';
if (inwhat >= 11)
{outbegin = jfancy[Math.floor(inwhat / 10)]};
if (inwhat >= 10)
{outmiddle = jfancy[10]};
if (inwhat % 10 != 0)
{outend = jfancy[inwhat % 10]};
outwhat = outbegin + outmiddle + outend;
};
};
return outwhat;
};
function hanstart(how) {
var now = new Date();
hour = now.getHours(); // military
minute = now.getMinutes();
second = now.getSeconds();
foo = givehan(hour, how) + hanht + givehan(minute, how) + hanmt +
givehan(second, how) + hanst;
return foo;
};
// The style numbers:
// 0 = neutral
// 1 = short
// 2 = like neutral but also special hanzi for '20' and '30'
// 3 = very ornate, Japanese style
var HanClockStyle = 3;
function upclock()
{
var HanclockLayer = document.getElementById('hanclock');
HanclockLayer.innerHTML = hanstart(HanClockStyle);
}
function Initialize()
{
upclock();
setInterval("upclock()", 1000);
}
//-->
</script>
</head>
<body onload="Initialize();">
<div id="hanclock" style="font-size: 18pt; font-weight: bold; color: #FFDF00; border: 5px ridge yellow; background-color: black; float:left; height:380px; margin-right:20px">
</div>
</body>
</html>
阿博
2002-10-10
打赏
举报
回复
javaScript 中有 unicode 编码转换吗?
我在HTML中直接指定:<meta http-equiv=Content-Type content=text/html; charset=gb2312>的。
并且,已经不是处在服务端了,java中的转换功能用不上。
急呀,同志们,贡献你们的聪明才智,救兄弟于水火之中呀!
孟子E章
2002-10-10
打赏
举报
回复
用unicode编码来做
javaScript
encodeURI
中
文
乱码
javaScript
encodeURI
中
文
乱码
eclipse导入工程
中
文
乱码
问题
eclipse导入工程
中
文
乱码
问题
myeclipse
中
文
乱码
问题
myeclipse
中
文
乱码
问题 myeclipse
中
文
乱码
问题myeclipse
中
文
乱码
问题myeclipse
中
文
乱码
问题myeclipse
中
文
乱码
问题myeclipse
中
文
乱码
问题myeclipse
中
文
乱码
问题
关于asp.net
中
中
文产生
乱码
问题
关于asp.net
中
中
文产生
乱码
问题
【
文件
下载】及解决
文件
名
中
文
乱码
问题
NULL 博文链接:https://gaojunwei.iteye.com/blog/1958714
JavaScript
87,996
社区成员
224,693
社区内容
发帖
与我相关
我的任务
JavaScript
Web 开发 JavaScript
复制链接
扫一扫
分享
社区描述
Web 开发 JavaScript
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章