关于下拉菜单的国际化问题

e213738 2009-05-19 08:07:41
有个需求是支持埃塞俄比亚的amharic语言,我在页面里加了资源标签实现的。但是在下拉菜单selsect控件中就有问题:
<select size="1" name="searchkey1" class="select-style0" onchange="javascript:modeChanged()">
<option value="uploadtime"><i18n:message key="UserMSG0015237" /></option>
</select>
上边的在ie6下就显示成乱码,但是在ie7下就正常显示。但是如果我把同样的标签放在页面其他地方,比如
<font class="font2"><i18n:message key="UserMSG0015232" /></font>
就都可以显示正确。我怀疑是ie6不支持amharic语,不知道是不是这样,有没有什么解决方法。
...全文
317 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
e213738 2009-05-23
  • 打赏
  • 举报
回复
我做了一个测试页面代码如下:把上边的js加进去就行了
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 2</title>
<script language="javascript">


</script>
</head>
<body>
<input type=submit name="cry" value="点击我一下下^_^" style="width: 110px; height: 30px" onclick='return cry();'></input><br><br><br>
<select size="1" name="ds_lb" style=width:100%><option selected value="">请选择</option><option value="1">选项1</option><option value="2">选项2</option></select><br><br>
<select size="1" name="ds_lb" style=width:100%><option selected value="">请选择</option><option value="1">选项1</option><option value="2">选项2</option></select><br><br>
<select size="1" name="ds_lb" style=width:100%><option selected value="">请选择</option><option value="1">选项1</option><option value="2">选项2</option></select>11111111111111111<br><br>
<select size="1" name="ds_lb" style=width:100%><option selected value="">请选择</option><option value="1">选项1</option><option value="2">选项2</option></select>1111111111111111111<br><br>
<select size="1" name="ds_lb" style=width:100%><option selected value="">请选择</option><option value="1">选项1</option><option value="2">选项2</option></select><br><br>
<select size="1" name="ds_lb" style=width:100%><option selected value="">请选择</option><option value="1">选项1</option><option value="2">选项2</option></select>
<p>
</p>
</body>
</html>[/code]
e213738 2009-05-23
  • 打赏
  • 举报
回复
window.alert = function(txt)
{
var shield = document.createElement("DIV");
shield.id = "shield";
shield.style.position = "absolute";
shield.style.left = "0px";
shield.style.top = "0px";
shield.style.width = "100%";
shield.style.height = document.body.scrollHeight+"px";
shield.style.background = "blue";
shield.style.textAlign = "center";
shield.style.zIndex = "10000";
shield.style.filter = "alpha(opacity=0)";
var iframe = document.createElement("iframe");
iframe.id = "iframe";
iframe.style.scrolling="0";
iframe.style.frameborder="0";
iframe.style.position = "absolute";
iframe.style.left = "0px";
iframe.style.top = "0px";
iframe.style.width = "100%";
iframe.style.height = "100%";
iframe.style.filter = "alpha(opacity=0)";
iframe.style.zIndex = "9999";
var alertFram = document.createElement("DIV");
alertFram.id="alertFram";
alertFram.style.position = "absolute";
alertFram.style.left = "50%";
alertFram.style.top = "50%";
alertFram.style.marginLeft = "-125px";
alertFram.style.marginTop = "-75px";
alertFram.style.width = "250px";
alertFram.style.height = "75px";
alertFram.style.background = "#000";
alertFram.style.textAlign = "center";
alertFram.style.lineHeight = "75px";
alertFram.style.zIndex = "10001";
strHtml = "<ul style=\"list-style:none;margin:0px;padding:0px;width:100%\">\n";
strHtml += "<li style=\"background:#002F9C;text-align:left;padding-left:5px;font-size:14px;font-weight:bold;color: #FFFFFF;height:25px;line-height:25px;border-left:1px solid #FFFFFF;border-top:1px solid #FFFFFF;border-right:1px solid #FFFFFF;\"></li>\n";
strHtml += "<li style=\"background:#5A7EDC;text-align:center;font-size:12px;color: #FFFFFF;height:75px;line-height:75px;border-left:1px solid #FFFFFF;border-right:1px solid #FFFFFF;\">"+txt+"</li>\n";
strHtml += "<li style=\"background:#002F9C;text-align:center;font-weight:bold;height:25px;line-height:25px; border-left:1px solid #FFFFFF;border-bottom:1px solid #FFFFFF;border-right:1px solid #FFFFFF;\"><input type=button value=' OK ' onclick=\"remove()\"></li>\n";
strHtml += "</ul>\n";
alertFram.innerHTML = strHtml;
document.body.appendChild(alertFram);
document.body.appendChild(iframe);
document.body.appendChild(shield);
var c = 0;
this.doAlpha = function(){
if (c++ > 50){clearInterval(ad);return 0;}
shield.style.filter = "alpha(opacity="+c+");";
}
this.remove=function(){
alertFram.innerHTML="";
shield.style.filter = "";
shield.id = "";
shield.style.position = "";
shield.style.left = "";
shield.style.top = "";
shield.style.width = "";
shield.style.height ="";
shield.style.background = "";
shield.style.textAlign = "";
shield.style.zIndex = "";
shield.style.filter = "";
alertFram.id="";
alertFram.style.position = "";
alertFram.style.left = "";
alertFram.style.top = "";
alertFram.style.marginLeft = "";
alertFram.style.marginTop = "";
alertFram.style.width = "";
alertFram.style.height = "";
alertFram.style.background = "";
alertFram.style.textAlign = "";
alertFram.style.lineHeight = "";
alertFram.style.zIndex = "";
document.body.removeChild(iframe);
}
var ad = setInterval("doAlpha()",10);
alertFram.focus();
document.body.onselectstart = function(){return false;};
}
e213738 2009-05-23
  • 打赏
  • 举报
回复
楼上的很拽,不过我要这么搞估计就要回家了。问题已经解决了,我在select上加了样式,其中font-family: "nyala";
nyala就是amharic语的字体族科,现在搞定,只是还不是很理解原理是什么,大家都来讨论下吧。好,现在老问题被解决了,但是新的问题又出现了
那就是alert打出的提示信息也存在不能显示的问题。但是我又不能给alert加样式,很是郁闷。不过我找到个办法,自己重载alert。这样就可以加样式了
只不过又出现了新的问题:如果网页包涵<%@include file="testjsp" %>,而在test.jsp里有个alert的话,那么这个alert就会处在test.jsp的中间,而不是浏览器窗口的中间。而且我的覆盖层也只能覆盖整个test.jsp,不能覆盖到父框架,看看大家有没有什么解决的办法。
我把代码加在下边:(太大了我回复下下边)

suncf1985 2009-05-21
  • 打赏
  • 举报
回复
写上说明:IE7以上使用...IE7下不负责
ndcs_dhf2008 2009-05-21
  • 打赏
  • 举报
回复
你可以去ie官方找找,估计是ie6的问题.
e213738 2009-05-21
  • 打赏
  • 举报
回复
amharic语是操作系统部支持的,但是我后来安装了字符集。浏览器的话,也是不支持的,但是我把浏览器的编码设置成utf-8,页面其他地方都能显示出来了,就下拉菜单不行,很是奇怪。
qiheia 2009-05-20
  • 打赏
  • 举报
回复
我在做国际化的时候,没有遇到过这样的问题,是不是你的IE6没有安装这种语言呢?
e213738 2009-05-20
  • 打赏
  • 举报
回复
经过进一步测试在ie7和火狐下都正常,就ie6不行,兄弟们有没有什么解决的思路呢。
e213738 2009-05-20
  • 打赏
  • 举报
回复
<option value="uploadtime"> <font class="font2"> <i18n:message key="UserMSG0015232" /> </font> </option>
试验过这样无效。

我还试验过先把值取出来,然后用js加到select中,如下:
function addOption(){
var addSinggername='<i18n:message key="UserMSG0015237" />';
document.inputForm.searchkey1.add(new Option(addSinggername,"2"));
}
同样无效

还请各位兄弟姐妹多多帮忙啊。
e213738 2009-05-20
  • 打赏
  • 举报
回复
<option value="uploadtime"> <font class="font2"> <i18n:message key="UserMSG0015232" /> </font> </option>
这样试验过,无效。
我还试过把值先取出来,然后再用js加到select里,如下:
function addOption(){
var addSinggername='<%=authorname%>';
document.inputForm.searchkey1.add(new Option(addSinggername,"2"));

}
同样无效。
还请各位兄弟姐妹帮帮忙。
qiheia 2009-05-20
  • 打赏
  • 举报
回复
既然这样的话,你为什么不这样放呢?
<option value="uploadtime"><font class="font2"><i18n:message key="UserMSG0015232" /></font> </option>
yangkaixin1226 2009-05-19
  • 打赏
  • 举报
回复
不懂,帮顶。
lgq_0714 2009-05-19
  • 打赏
  • 举报
回复
友情帮顶!!!国际化是蛮烦人的!!!
lovezx1028 2009-05-19
  • 打赏
  • 举报
回复
也都是一样的原理嘛
攻程狮… 2009-05-19
  • 打赏
  • 举报
回复
关注。。楼主好牛啊。都做埃塞俄比亚的amharic语言的了。。

81,095

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧