使用firefox xmlhttprequest同步的时候,是不会onreadystatechange事件的,但在IE下会触发,到firefox网站上查了下,发现这个方法要这么写
Javascript代码 收藏代码
它直接跟在send后面,在IE下也是可以的。
Javascript代码 收藏代码
oXmlHttp.open('GET', url,false);
oXmlHttp.send();
if ( oXmlHttp.status == 200 || oXmlHttp.status == 304 ){
IncludeJS( url, sId, oXmlHttp.responseText );
}
else{
alert( 'XML request error: ' + oXmlHttp.statusText + ' (' + oXmlHttp.status + ')' ) ;
}
它直接跟在send后面,在IE下也是可以的。