如何在alert的提示中显示多语言 <meta http-equiv="Content-Type" content="text/html; charset=gb2312">改charset吧 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 应该根据window.navigator.browserLanguage来确定吧 switch (window.navigator.browserLanguage){ case 'zh-cn' : alert('中文');break; case 'ja' : alert('japanese');break; case 'en' : alert('english'); break; .......} 从服务器端判断用户是何种语言,加载相应的语言,并repsonse.write显示到页面上,alert时再其中取就可以了。代码摘要如下://加载资源文件(所有文件必须位approot\resource\chg(eng)\)UIResource UIRes=null;////备第一次load时使用RunResource RunRes=null;if (!IsPostBack) { string ResourceRootPath=Application["RootPath"].ToString();//load UI Resource from resource file UIRes = new UIResource(ResourceRootPath,cResID, Session["UserLanguage"].ToString()); //load Runtime Resource from resource fileRunRes = new RunResource(ResourceRootPath,cResID, Session["UserLanguage"].ToString(), ViewState);}else{RunRes = new RunResource(ViewState);}//load runtime resource to IE Client page from view stateRegisterClientScriptBlock("RES00", RunRes.GetScriptResource());///加载资源文件结束 在客户IE中的情形是:<script language=javascript> var res= new Array(3) res[0]="Do you be sure to delete selected items?" //1001 res[1]="Delete data ok." //1002 res[2]="Save Data Error,please check your data." //1003 </script>function Check_Input() { if (document.Form1.txtSubject.value=="") { alert(res[1]); return false; } } 想知道这个效果,JS是怎么做的? ExtJs4.2中把Panel嵌入到tabPanel的问题 json数据 层自适应高度 onclick的问题 求js中动态添加onchick()事件(兼容ie和firefox等) 一个最简单的问题 如何控制表格不被拉长? 如何用javascript给form增加一个控件? 为什么我的IE里查看栏没有“脚本程序调试”项? 多个iframe,如何根据包含的内容的高和宽决定iframe的高度 求解
{
case 'zh-cn' : alert('中文');break;
case 'ja' : alert('japanese');break;
case 'en' : alert('english'); break;
.......
}
alert时再其中取就可以了。
代码摘要如下:
//加载资源文件(所有文件必须位approot\resource\chg(eng)\)
UIResource UIRes=null;////备第一次load时使用
RunResource RunRes=null;
if (!IsPostBack)
{
string ResourceRootPath=Application["RootPath"].ToString();
//load UI Resource from resource file
UIRes = new UIResource(ResourceRootPath,cResID, Session["UserLanguage"].ToString());
//load Runtime Resource from resource file
RunRes = new RunResource(ResourceRootPath,cResID, Session["UserLanguage"].ToString(), ViewState);
}
else
{
RunRes = new RunResource(ViewState);
}
//load runtime resource to IE Client page from view state
RegisterClientScriptBlock("RES00", RunRes.GetScriptResource());
///加载资源文件结束 在客户IE中的情形是:
<script language=javascript>
var res= new Array(3)
res[0]="Do you be sure to delete selected items?" //1001
res[1]="Delete data ok." //1002
res[2]="Save Data Error,please check your data." //1003
</script>function Check_Input()
{
if (document.Form1.txtSubject.value=="")
{
alert(res[1]);
return false;
}
}