Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript JSF2和jquery lang js插件不翻译IE9中的h:outputLabel_Javascript_Jquery_Jsf_Jquery Plugins_Jsf 2 - Fatal编程技术网

Javascript JSF2和jquery lang js插件不翻译IE9中的h:outputLabel

Javascript JSF2和jquery lang js插件不翻译IE9中的h:outputLabel,javascript,jquery,jsf,jquery-plugins,jsf-2,Javascript,Jquery,Jsf,Jquery Plugins,Jsf 2,我正在使用插件来翻译我的页面。在IE8中一切都很好,但是在IE9中,h:outputLabel的标签没有被翻译。。为什么会这样?我该如何解决这个问题 我的代码示例: <h:body> <script type="text/javascript"> $().ready(function () { window.lang = new jquery_lang_js(); window.lang.run(); window.lang.change(language); $

我正在使用插件来翻译我的页面。在IE8中一切都很好,但是在IE9中,
h:outputLabel
的标签没有被翻译。。为什么会这样?我该如何解决这个问题

我的代码示例:

<h:body>

<script type="text/javascript">

$().ready(function () {
window.lang = new jquery_lang_js();

window.lang.run();
window.lang.change(language);

$('*').each(function()
{              
    var attr = $(this).attr('lang');
    if (typeof attr !== 'undefined' && attr !== false) 
    {
        $(this).attr("lang", language);                              
    }
}); 
}); 
 </script>
<h:form id="testForm" dir="#{bean.dir}" >  
<h:panelGrid id="testTable" columns="2" dir="#{bean.dir}" rowClasses="rowTop,rowBottom"          columnClasses="column1,column2">
<h:outputLabel value="User Code:" for="userCode"  lang="en"/>
<h:outputLabel/>                           
<h:inputText id="userCode" value="#{bean.userCode}"/>             
     <h:message id="userCodeMSG" for="userCode" showDetail="false" showSummary="true" styleClass="message"/>                                                 
 </h:panelGrid>  
 </h:form>

</h:body> 

$().ready(函数(){
window.lang=newjquery_lang_js();
window.lang.run();
window.lang.change(语言);
$('*')。每个(函数()
{              
var attr=$(this.attr('lang');
if(类型属性!='undefined'&&attr!==false)
{
$(this.attr(“lang”,语言);
}
}); 
}); 
请帮忙!!
提前谢谢。

我不知道是否能帮上忙,但我有一些想法:

  • 您可以将此元标记
    放在中,以强制IE9像IE8一样呈现页面
  • <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
  • 或者,您可以等待加载所有文档,然后启动函数。您可以使用$(document).ready(function()实现这一点{ $( document ).ready(function() { //Put your code here }); //把你的代码放在这里 });