求高手帮我看下代码,小女子新手,谢了

wangqi1986813 2009-04-27 11:05:26
下面的代码主要是想变换语言,之前只是练习做了简单的下拉框,现在我把下拉框的代码放进去,只是出现的下拉框的位置不知道该怎么设定?还有个问题,就是怎样将页面中其他的文本变换语言啊,主要就是怎么引用其文本的值,然后让它和数组中的对应语言的文本关联起来呢?谢谢了
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<STYLE TYPE="text/css"><!--
body { font-family: Arial, Helvetica, sans-serif, Verdana; margin-left:0; margin-right:0; margin-top:0; margin-bottom:0; }
input { margin-top:0; margin-bottom:0; padding-top:0; padding-bottom:0; }
select { margin-top:0; margin-bottom:0; padding-top:0; padding-bottom:0; }
a { color:#0033CC; text-decoration:none }
a:hover, a:active { color:#0033CC; text-decoration:underline }
--></STYLE>
<title>Dell 2135cn MFP</title>
</head>
<body bgcolor="#FFFFFF" link="#0033CC" alink="#0033CC" vlink="#0033CC">
<style type="text/css">
<!--
body { margin-left:0; margin-right:0; margin-top:0; margin-bottom:0; border-bottom:1px ridge #666666; }
-->
</style>
<div style="position:absolute; top:0px; left:0px; width:599px; height:140px; overflow:auto">
<table border="0" cellpadding="0" cellspacing="0">
<tr><td nowrap><font size=+1 color="#333333"><b>
Dell 2135cn MFP</font></b></td></tr>
<tr><td nowrap><font color="#666666">
IPv4: 10.136.4.23</font></td></tr>
<tr><td><font color="#666666">
Location: </font></td></tr>
<tr><td><font color="#666666">
Contact Person: </font></td></tr>
</table>
</div>

<div style="position:absolute; top:20px; left:630px; ">
<a href="status/status.htm" target="RightFrame">
<img src="images/D2135cn_01.png" width=100 height=100 border="0"></a>
</div>

<table style="height:100%; width:100%;"><tr><td></td></tr></table><form name="form1">
<SELECT id=language name=language size=1>
<OPTION selected>English</OPTION>
<OPTION >Simple Chinese</OPTION>
</SELECT>
</form>
<input type="button" value="change" onclick="chang_language(this)"/>
<script language="javascript">
<!--
var EC=[
["简体中文","Simple Chinese"],
["英文","English"],
["改变","change"],
["定位","Location"],
["联系人","Contact Person"]
]
function chang_language(_this){
var select_obj=document.getElementById("language")
var index=select_obj.selectedIndex;
if(index=="1"){
select_obj.options[0].text=EC[0][1];
select_obj.options[1].text=EC[1][1];
_this.value=EC[2][1];
}
else if(index=="0"){
select_obj.options[0].text=EC[0][0];
select_obj.options[1].text=EC[1][0];
_this.value=EC[2][0];}
else
{return;}
}
//-->
</script>



</body>
</html>
...全文
130 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
浴火_凤凰 2009-04-27
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 Free_Wind22 的回复:]
你这个可以这样改


HTML code
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<STYLE TYPE="text/css"> <!--
body { font-family: Arial, Helvetica, sans-serif, Verdana; margin-left:0; margin-right:0; margin-top:0; margin-bottom:0; }
input { margin-top:0; margin-bottom:0; padding-top:0; padding-bottom:0; }
select { margin-top:0; margin-bottom:0; pa…
[/Quote]
就是这个意思吧!!!
tantaiyizu 2009-04-27
  • 打赏
  • 举报
回复
又见小女子
2009-04-27
  • 打赏
  • 举报
回复
你这个可以这样改


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<STYLE TYPE="text/css"> <!--
body { font-family: Arial, Helvetica, sans-serif, Verdana; margin-left:0; margin-right:0; margin-top:0; margin-bottom:0; }
input { margin-top:0; margin-bottom:0; padding-top:0; padding-bottom:0; }
select { margin-top:0; margin-bottom:0; padding-top:0; padding-bottom:0; }
a { color:#0033CC; text-decoration:none }
a:hover, a:active { color:#0033CC; text-decoration:underline }
--> </STYLE>
<title>Dell 2135cn MFP </title>
</head>
<body bgcolor="#FFFFFF" link="#0033CC" alink="#0033CC" vlink="#0033CC">
<style type="text/css">
<!--
body { margin-left:0; margin-right:0; margin-top:0; margin-bottom:0; border-bottom:1px ridge #666666; }
-->
</style>
<div id="t" style="position:absolute; top:0px; left:0px; width:599px; height:140px; overflow:auto">
<table border="0" cellpadding="0" cellspacing="0">
<tr> <td nowrap> <font size=+1 color="#333333"> <b>
Dell 2135cn MFP </b></font> </td> </tr>
<tr> <td nowrap> <font color="#666666">
IPv4: 10.136.4.23 </font> </td> </tr>
<tr> <td> <font color="#666666">
Location: </font> </td> </tr>
<tr> <td> <font color="#666666">
Contact Person: </font> </td> </tr>
</table>
</div>

<div style="position:absolute; top:20px; left:630px; ">
<a href="status/status.htm" target="RightFrame">
<img src="images/D2135cn_01.png" width=100 height=100 border="0"> </a>
</div>

<table style="height:100%; width:100%;"> <tr> <td> </td> </tr> </table> <form name="form1">
<SELECT id="language" name="language" size="1">
<OPTION selected>English </OPTION>
<OPTION >Simple Chinese </OPTION>
</SELECT>
</form>
<input type="button" value="change" onclick="change_language(this)"/>
<script language="javascript">
<!--
var EC=[
["简体中文","Simple Chinese"],
["英文","English"],
["改变","change"],
["定位","Location"],
["联系人","Contact Person"]
];
function change_language(_this){
var select_obj=document.getElementById("language")
var index = -select_obj.selectedIndex + 1;
select_obj.options[0].text = EC[1][index];
select_obj.options[1].text = EC[0][index];
_this.value = EC[2][index];
var div = document.getElementById("t");
for(var i=3; i<EC.length; i++){
var reg = new RegExp(EC[i][select_obj.selectedIndex], "ig");
div.innerHTML = div.innerHTML.replace(reg, EC[i][index]);
}
}
//-->
</script>

</body>
</html>

wangqi1986813 2009-04-27
  • 打赏
  • 举报
回复
希望能有高手给予指点,谢谢了
wangqi1986813 2009-04-27
  • 打赏
  • 举报
回复
尝试过用另一个站,但是我们要做的语言有很多,如果都链接到站的话,容量太大,不合理,所以就想用这样的方法试试
2009-04-27
  • 打赏
  • 举报
回复
语言切换没这么简单, 一般是链到另一个站
wangqi1986813 2009-04-27
  • 打赏
  • 举报
回复
自己顶,希望有人能帮忙
wangqi1986813 2009-04-27
  • 打赏
  • 举报
回复
回答楼上的楼上的问题,我们做的是有11个国家的语言,现在只是先做个简单的例子,寻找一种好点的方法,再做多国的
街头小贩 2009-04-27
  • 打赏
  • 举报
回复
如果I18N支持就更好了
gengzhw 2009-04-27
  • 打赏
  • 举报
回复
问楼主一个问题,作这个是为了应付领导的任务,还是为了最终用户使用
如果是为最终用户考虑,你看一下你的功能实现有下面的问题:
在显示为英文界面时,全部为英文词语,包括那个“Simple Chinese”,
    想一下什么人才需要切换到中文:是不懂英文的才需要这个功能,
        这个界面中的“Simple Chinese”是不是应该显示为“简体中文”?
同理,在显示为简体中文界面时,全部为中文词语,包括那个“英文”,
    又有什么人才需要切换到英文:是不懂中文的,需要把这个界面中的那个"英文" 改成 "English"

87,907

社区成员

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

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