日期:2014-05-16 浏览次数:20559 次
if( language == english) { //只加载en.js }else( language == Traditional Chinese) { //只加载trach.js }else( language == simple chinese) { //只加载sipch.js ]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>new document</title> <script type="text/javascript"> function loadScript(url){ document.write("<scr" + "ipt src='" + url + "' ></scr" + "ipt>"); } if(language == english) { //只加载en.js loadScript("en.js"); }else( language == Traditional Chinese) { //只加载trach.js loadScript("trach.js"); }else( language == simple chinese) { //只加载sipch.js loadScript("sipch.js"); } </script> </head> <body> </body> </html>
------解决方案--------------------
var head= document.getElementsByTagName('head')[0]; var script=document.createElement("script"); script.type= 'text/javascript'; if( language == english) {script.src="en.js"; //只加载en.js }else( language == Traditional Chinese) {script.src="en.js"; //只加载trach.js }else( language == simple chinese) {script.src="en.js"; //只加载sipch.js } head.appendChild(script);
------解决方案--------------------
<script type="text/javascript" id="language" src=""></script> <script type="text/javascript"> if (language == english) { language.src = "en.js"; } else if (language == "chinese") { language.src = "ch.js"; } </script>
------解决方案--------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>new document</title>
<script type="text/javascript">
function loadScript(url){
document.write("<scr" + "ipt src='" + url + "' ></scr" + "ipt>");
}
if(language == english)
{
//只加载en.js
<%@ include file="en.js"%>
}else( language == Traditional Chinese)
{
//只加载trach.js
<%@ include file="trach.js"%>
}else( language == simple chinese)
{
//只加载sipch.js
<%@ include file="sipch.js"%> }
</script>
</head>
<body>
</body>
</html>
------解决方案--------------------
jquery
$.getScript("123.js")