开发者

How do I change one of the parameters in script

开发者 https://www.devze.com 2023-03-19 03:31 出处:网络
One of the parameters in the script tag may change dynamically - djConfig=\"parseOnLoad:true, locale:\'fr-fr\'

One of the parameters in the script tag may change dynamically - djConfig="parseOnLoad:true, locale:'fr-fr'

Script tag:开发者_高级运维

<script type="text/javascript" 
        src="dojo-release-1.6.1/dojo/dojo.js"
        djConfig="parseOnLoad:true, locale:'fr-fr' />

where locale may be either fr-fr or en-us,...

How do I create the script tag?


I suggest explicitly creating the djConfig object before including the dojo core (as outlined in their docs):

<script type="text/javascript">
    var currentLocale;

    if([Your Logic Here])
    {
        currentLocale = 'en-us';
    }
    else
    {
        currentLocale = 'fr-fr';
    }

    var djConfig = {
        parseOnLoad: true,
        isDebug: true,
        locale: currentLocale,
        extraLocale: ['ja-jp']
    };
</script>
<script type="text/javascript" src="http://o.aolcdn.com/dojo/1.4.2/dojo/dojo.xd.js">
</script>

Please check out the dojo docs on the subject.

NOTE: You should never use self-closing script tags.

0

精彩评论

暂无评论...
验证码 换一张
取 消