【编者按】:网学网Ajax为您提供ajax实现标签导航参考,解决您在ajax实现标签导航学习中工作中的难题,参考学习。
主要函数:复制代码 代码如下:
<!--
function getObject(objectId) {
if(document.getElementById && document.getElementById(objectId)) {
// W3C DOM
return document.getElementById(objectId);
}
else if (document.all && document.all(objectId)) {
// MSIE 4 DOM
return document.all(objectId);
}
else if (document.layers && document.layers[objectId]) {
// NN 4 DOM.. note: this won''t find nested layers
return document.layers[objectId];
}
else {
return false;
}
}
var responsecont;
var xmlHttp;
var requestType;
var newsstring;
function CreateXMLHttpRequest(){
// Initialize Mozilla XMLHttpRequest object
if (window.XMLHttpRequest){
xmlHttp = new XMLHttpRequest();
}
// Initialize for IE/Windows ActiveX version
else if (window.ActiveXObject) {
try{
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP.3.0");
}
catch (e){
try{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e){newsstring = "<div class=''loading''>Loading rquest content fail, Please try it again latter...</div>";}
}
}
}
function getnews(tagid,x){
var url = tagid+''_''+x+''.htm'';
var loadstatustext="<div class=''loading''><img src=''/uploadfile/201307/11/1B944837.gif'' /> Loading request content, please wait...</div>";
requestType = tagid;
CreateXMLHttpRequest();