日期:2014-05-16  浏览次数:20397 次

html调用JS文件不显示内容

<div id="banner"><script type="text/javascript" src="js/banner.js"></script>
</div>
下面是JS文件内容:
<script type="text/javascript">
        <!-- 
        var focus_width=960;
        var focus_height=300;
        var text_height=0;
        var swf_height = focus_height+text_height;
        var pics = "";
        var links = "";
        var texts = "";
        pics += "images/banner1.jpg|images/banner2.jpg|images/banner3.jpg"; 
 
        document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
        document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="images/focus.swf"><param name="quality" value="high"><param name="bgcolor" value="#FFFFFF">');
        document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
        document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
        document.write('<embed src="images/focus.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" ?bgcolor="#ffffff" quality="high" width="'+ focus_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');  document.write('</object>');
        //-->
        </script>
如果把JS内容全部复制过去就可以正常显示

------解决方案--------------------
js文件里不需要<script type="text/javascript"></script>标签