呵呵。我认为应该是我说的原因。你可以在仔细测试一下,这可能是ie的问题。你换个浏览器会发现问题消失了,不同浏览器处理http相应是有的差别,而且用get方式是有限制的。你可以看看RFC中的http。 而W3C也有相应的说明 Those that are executed one time when the document is loaded by the user agent. Scripts that appear within a SCRIPT element are executed when the document is loaded. For user agents that cannot or will not handle scripts, authors may include alternate content via the NOSCRIPT element. Those that are executed every time a specific event occurs. These scripts may be assigned to a number of elements via the intrinsic event attributes. 你可以做以下测试,把那个js文件写得很大很大,在html中直接调用js的函数或是变量名称,当你一发现html显示完毕后,就去调用。问题就出来了。 所以不推荐使用像你那样的globel写法,如果是异步的情况,你会发现情况会更严重。呵呵
真奇怪啊
--------------------------------------------
win2k 5.0 sp4+IIS 5.0+IE6.0,没有任何问题。
这种问题几乎天天碰到。经常时一个新的地方出错,导致一些原来work的地方出错。
你先一块一块JS去掉,看看是哪块报错了
将URL中的计算机名"MyComputer"换成IP地址就可以!http://192.168.1.100/Play.asp?SongsID=12/7282/69273_12/7282/69274_12/7282/69275_12/7282/69276_12/7282/69277_12/7282/69278_12/7282/69279_12/7282/69280_12/7282/69281_12/7282/69282_12/7282/69283_12/7282/69284_12/7282/69285_12/7282/69286_12/7282/69287_12/7282/69288_12/7282/69289_12/7282/69290_12/7282/69291_12/7282/69292_12/7282/69293_12/7282/69294_12/7282/69295_12/7282/69296_12/7282/69297_12/7282/69298_12/7282/69299_12/7282/69300_12/7282/69301_12/7282/69302_12/7282/69303_12/7282/69304_12/7282/69305_12/7282/69306_12/7282/69307_12/7282/69308_12/7282/69309_12/7282/69310_12/7282/69311_12/7282/69312_12/7282/69313_12/7282/69314_12/7282/69315_12/7282/69316_12/7282/69317_这样没问题,但为什么会IP就可以呢?
alert("haha");
分别用两种情况 看看能不能弹出来
应该写成b(<%=wma%>)吧??
由于<Script src="..."...>标记在加载js的时候与htm不是同步处理的,IE把html加载完成后
并不保证js也加载完成了。此时你去调用js文件中的变量可能就出错了,
根据HTTP协议
IE先发送GET /Play.asp HTTP1.1
IE收到解析的页面后再发送GET /mu.js HTTP1.1
至于html和js之间调用是由IE来决定的
上可能IE是用不同个线程来处理,所以在不同配置即使在相同机器上加载的过程也可能不一样
推荐直接把变量直接写在HTML中
<script languange="javascript">
var wma="Temp/wma.m3u";
</script>如果要使用<script src='...'>方式最好在调用js文件里面的变量或函数时,判断该SCRIPT的状态
而W3C也有相应的说明
Those that are executed one time when the document is loaded by the user agent. Scripts that appear within a SCRIPT element are executed when the document is loaded. For user agents that cannot or will not handle scripts, authors may include alternate content via the NOSCRIPT element.
Those that are executed every time a specific event occurs. These scripts may be assigned to a number of elements via the intrinsic event attributes. 你可以做以下测试,把那个js文件写得很大很大,在html中直接调用js的函数或是变量名称,当你一发现html显示完毕后,就去调用。问题就出来了。
所以不推荐使用像你那样的globel写法,如果是异步的情况,你会发现情况会更严重。呵呵
这个现象的最直接的原因肯定是mu.js没有加载,至于为什么没有加载的原因,就很偶然了,可能是IE的一个bug。
你用非IE内核的浏览器试试看。