JS里面包含有JS。
我需要像下面这样JS里面包含有JS。
但如何写才正确?谢谢高手指教。
<script type="text/javascript">
if (location.host=="www.zhuatu.com" )
{
document.write("<script language=javascript src=http://www.zhuatu.com/1.js></"+"script>")
}
else
{
document.write("<script language=javascript src=http://www.zhuatu.com/2.js></"+"script>")
}
</script>
------解决方案--------------------
参考google分析的:
<script type="text/javascript">
//google分析
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>