| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1587 人关注过本帖
标题:[求助]ajax兼容问题
只看楼主 加入收藏
我才是阿军啊
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2007-5-14
收藏
 问题点数:0 回复次数:0 
[求助]ajax兼容问题

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


<!--
var xmlHttp;
function GetNowTime(){
var date = new Date(); //ÈÕÆÚ¶ÔÏó
var now = \"\";
now = date.getFullYear()+\"y\";
now = now + (date.getMonth()+1)+\"m\";
now = now + date.getDate()+\"d\";
now = now + date.getHours()+\"h\";
now = now + date.getMinutes()+\"m\";
now = now + date.getSeconds()+\"s\";
return now;
}
function CleanLoading(){
document.getElementById('loading').innerHTML = \"\";
}
function createXMLHttpRequest(){
if (typeof XMLHttpRequest == \"undefined\"){
var xmlHttpVersions = [ \"MSXML2.XMLHttp.5.0\",\"MSXML2.XMLHttp.4.0\",\"MSXML2.XMLHttp.3.0\",\"MSXML2.XMLHttp\",\"Microsoft.XMLHttp\"];
for(var i = 0;i < xmlHttpVersions.Length;i++){
try{
return new ActiveXObject(xmlHttpVersions[i]);
}
catch(oError){
//there is nothing to do with
}
}
throw new error(\"there whould be no error at all!\");
}
else if (window.XMLHttpRequest){
return new XMLHttpRequest();
}
}

if (ajax == null && typeof XMLHttpRequest != 'undefined')
{
ajax = new XMLHttpRequest();
}

return ajax;
}
function starRequest(object,VerID){
var url;
switch(object){
case 1: { //Â¥ÅÌÐÅÏ¢,ÏîÄ¿¸Å¿ö
url = \"/ajax/gaikuang.php?VerID=\"+VerID+\"&time=\"+GetNowTime();//¼ÓÈëʱ¼ä´Á,±ÜÃâä¯ÀÀÆ÷»º´æ
break;
}
case 2: { //Â¥ÅÌÐÅÏ¢,ÏîÄ¿¸Å¿ö
url = \"/ajax/gaikuang.php?VerID=\"+VerID+\"&time=\"+GetNowTime();
break;
}
}
xmlHttp = createXMLHttpRequest();
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open(\"get\",url,true);
xmlHttp.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");
xmlHttp.send(null);
}
function handleStateChange(){
document.getElementById('loading').innerHTML = \"<img src='/images/loading3.gif'/>Êý¾Ý¼ÓÔØÖÐ...\";
if(xmlHttp.readyState == 4){
if(xmlHttp.status == 200){
document.getElementById('main').innerHTML = xmlHttp.responseText;
}
}
setTimeout(\"CleanLoading()\",500);
}
-->

搜索更多相关主题的帖子: ajax 
2007-06-26 22:16
快速回复:[求助]ajax兼容问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020491 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved