引用js实现传参数,然后在js文件里面动态加载东西,比如传递参数然后动态加载皮肤颜色,而我为了实现多语言,一般人家传递参数是为了区分版本用的还有清除js缓存问。
<script src="/js/jquery-1.9.1.min.js? LanguageKey=en" type="text/javascript"></script>
(function(e,t){
var scriptss = document.scripts;
//默认语言
var defaultlanguage = "en";
//获取当前scriptss
var indexoption = scriptss[scriptss.length - 1].src.indexOf("?");
if (indexoption < 0) {
document.write("<scri" + "pt src=‘/js/Language/" + defaultlanguage + ".js‘></sc" + "ript>")
} else {
//正则参数
var reg = /LanguageKey=([a-zA-Z0-9]*)?/;
if (reg.test(scriptss[scriptss.length - 1].src)) {
var LanguageKey = RegExp.$1;
document.write("<scri" + "pt src=‘/js/Language/" + LanguageKey + ".js‘></sc" + "ript>");
}
else {
document.write("<scri" + "pt src=‘/js/Language/" + defaultlanguage + ".js‘></sc" + "ript>")
}
}
})(window);