学习型 ASP/PHP/ASP.NET 主机 30元/年全能 ASP/PHP/ASP.NET 主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付
发新话题
打印

[求助]ajax兼容问题

[求助]ajax兼容问题

ajax兼容问题,大家帮我看看,我的在ff和opera下不惯用啊,急死人了,是不是js不规范,大家帮我修正下,谢谢.


复制内容到剪贴板
代码:
&lt;!--<BR>var xmlHttp;<BR>function GetNowTime(){<BR> var date = new Date(); //&Egrave;&Otilde;&AElig;&Uacute;&para;&Ocirc;&Iuml;ó <BR> var now = ""; <BR> now = date.getFullYear()+"y";<BR> now = now + (date.getMonth()+1)+"m";<BR> now = now + date.getDate()+"d"; <BR> now = now + date.getHours()+"h"; <BR> now = now + date.getMinutes()+"m"; <BR> now = now + date.getSeconds()+"s";<BR> return now;<BR>}<BR>function CleanLoading(){<BR> document.getElementById('loading').innerHTML = "";<BR>}<BR>function createXMLHttpRequest(){<BR> if (typeof XMLHttpRequest == "undefined"){<BR> var xmlHttpVersions = [ "MSXML2.XMLHttp.5.0","MSXML2.XMLHttp.4.0","MSXML2.XMLHttp.3.0","MSXML2.XMLHttp","Microsoft.XMLHttp"];<BR> for(var i = 0;i &lt; xmlHttpVersions.Length;i++){<BR> try{<BR> return new ActiveXObject(xmlHttpVersions[i]);<BR> }<BR> catch(oError){<BR> //there is nothing to do with<BR> }<BR> }<BR> throw new error("there whould be no error at all!");<BR> }<BR> else if (window.XMLHttpRequest){<BR> return new XMLHttpRequest();<BR> }<BR>}<BR> <BR> if (ajax == null &amp;&amp; typeof XMLHttpRequest != 'undefined')<BR> {<BR> ajax = new XMLHttpRequest();<BR> }<BR> <BR> return ajax;<BR>}<BR>function starRequest(object,VerID){<BR> var url;<BR> switch(object){<BR> case 1: { //&Acirc;&yen;&Aring;&Igrave;&ETH;&Aring;&Iuml;&cent;,&Iuml;&icirc;&Auml;&iquest;&cedil;&Aring;&iquest;&ouml;<BR> url = "/ajax/gaikuang.php?VerID="+VerID+"&amp;time="+GetNowTime();//&frac14;&Oacute;&Egrave;&euml;&Ecirc;±&frac14;&auml;&acute;&Aacute;,±&Uuml;&Atilde;&acirc;&auml;&macr;&Agrave;&Agrave;&AElig;÷&raquo;&ordm;&acute;&aelig;<BR> break;<BR> }<BR> case 2: { //&Acirc;&yen;&Aring;&Igrave;&ETH;&Aring;&Iuml;&cent;,&Iuml;&icirc;&Auml;&iquest;&cedil;&Aring;&iquest;&ouml;<BR> url = "/ajax/gaikuang.php?VerID="+VerID+"&amp;time="+GetNowTime();<BR> break;<BR> }<BR> }<BR> xmlHttp = createXMLHttpRequest();<BR> xmlHttp.onreadystatechange = handleStateChange;<BR> xmlHttp.open("get",url,true);<BR> xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");<BR> xmlHttp.send(null);<BR>}<BR>function handleStateChange(){<BR> document.getElementById('loading').innerHTML = "&lt;img src='/images/loading3.gif'/&gt;&Ecirc;&yacute;&frac34;&Yacute;&frac14;&Oacute;&Ocirc;&Oslash;&Ouml;&ETH;...";<BR> if(xmlHttp.readyState == 4){<BR> if(xmlHttp.status == 200){<BR> document.getElementById('main').innerHTML = xmlHttp.responseText;<BR> }<BR> }<BR> setTimeout("CleanLoading()",500);<BR>}<BR>--&gt;

TOP

发新话题