设置资源字符串在javascript [英] Set the Resource String in javascript
本文介绍了设置资源字符串在javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何设置JavaScript中的资源字符串?
How can I set the resource string in javascript?
我有一个称为资源文件,例如,
I have a resource file called, for example,
myResourceFile.resx
在我的code和使用文字的控制,我可以使用:
in my code and using the literal control I can use:
lblName.Text = Resources.myResourceFile.ajaxRetrievingInformation;
<asp:Literal id="lit" runat="server"
Text="<%$ Resources:myResourceFile, ajaxRetrievingInformation%>" />
但如果我尝试这在JavaScript中,这样的:
but if I try this in javascript, like:
<asp:Button ID="btnImportCompaniesAndEmployees"
runat="server"
CssClass="myButtonCssClass"
OnClick="btnImportCompaniesAndEmployees_Click"
OnClientClick="strLoadingText='<%$ Resources:myResourceFile, ajaxRetrievingInformation%>';return true;"
...
/>
或
<script type="text/javascript">
var strLoadingText = '<%$ Resources:myResourceFile, ajaxRetrievingInformation%>';
</script>
我得到的错误...
I get errors...
有谁知道如何管理呢? 类似于
Does anyone know how to manage this? Something like:
var strLoadingText = Resources.GetString(myResourceFile, ajaxRetrievingInformation);
感谢
推荐答案
您应该能够使用:
<script type="text/javascript">
var strLoadingText = "<%= Resources.myResourceFile.ajaxRetrievingInformation %>";
</script>
这篇关于设置资源字符串在javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文