ajax.js里面有内容显示效果,根据ID

时间:2021-05-28

ajax.js里面有内容显示效果,根据ID
复制代码 代码如下:
varhttp_request=false;
varsuccess=false;
varShowAllListFlag=1;
varDisplayArticle=true;
functionmakeRequest(url,cateID){

http_request=false;

if(window.XMLHttpRequest){//Mozilla,Safari,...
http_request=newXMLHttpRequest();
if(http_request.overrideMimeType){
http_request.overrideMimeType('text/xml');
}
}elseif(window.ActiveXObject){//IE
try{
http_request=newActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
http_request=newActiveXObject("Microsoft.XMLHTTP");
}catch(e){}
}
}

if(!http_request){
alert('Givingup:(CannotcreateanXMLHTTPinstance');
returnfalse;
}
http_request.onreadystatechange=alertContents;
http_request.open('GET',url,false);
http_request.send(null);
if(success==true)
{
try{
cateID.innerHTML=http_request.responseText;
}catch(e){}

success==false;
}

}

functionalertContents(){

if(http_request.readyState==4){
if(http_request.status==200){
success=true;
}else{
alert('Therewasaproblemwiththerequest.');
}
}

}

functionsetCatlog(ID,Order,LeftNumber){

varcateID=document.getElementById('Cate'+ID);
setdisplay(cateID);
if(cateID.style.display=="")
{
varurl2="INCLUDE/GetSiteListFunction.asp?ID="+ID+"&Order="+Order+"&LeftNumber="+LeftNumber+"&r="+Math.random();
makeRequest(url2,cateID);
}
else
{
varurl2="INCLUDE/GetSiteListFunction.asp?ID="+ID+"&RemoveID=1&r="+Math.random();
makeRequest(url2,cateID);
}
}

functionsetArticleList(EncodeURL,ArticleID){

if(DisplayArticle==true)
{
try{varobjArticleIDtop=document.getElementById('top'+ArticleID);
varobjArticleIDbottom=document.getElementById('bottom'+ArticleID);
if(objArticleIDtop)
{
if(objArticleIDtop.style.display=="none")
{

objArticleIDtop.style.display="";
}
else
{

objArticleIDtop.style.display="none";
}
}
if(objArticleIDbottom)
{
if(objArticleIDbottom.style.display=="none")
{
varurl2="INCLUDE/GetArticleFunction.asp?LinkStr="+EncodeURL+"&r="+Math.random();
makeRequest(url2,objArticleIDbottom);
objArticleIDbottom.style.display="";
}
else
{

objArticleIDbottom.style.display="none";
}
}

}catch(e){alert(e.description);}
}
else
{
}

}


functionDisplayContent(ArticleID){

if(DisplayArticle==true)
{
try{varobjArticleIDtop=document.getElementById('top'+ArticleID);
varobjArticleIDbottom=document.getElementById('bottom'+ArticleID);
if(objArticleIDtop)
{
if(objArticleIDtop.style.display=="none")
{

objArticleIDtop.style.display="";
}
else
{

objArticleIDtop.style.display="none";
}
}
if(objArticleIDbottom)
{
if(objArticleIDbottom.style.display=="none")
{

objArticleIDbottom.style.display="";
}
else
{

objArticleIDbottom.style.display="none";
}
}

}catch(e){alert(e.description);}
}
else
{
}

}

functionsetdisplay(cateID){
if(cateID.style.display=="none")
{
cateID.style.display="";
cateID.innerHTML="Loading..."
}
else
{
cateID.style.display="none";
}
}

functionsetdisplay2(cateID){

if(ShowAllListFlag==1)
{
cateID.style.display="";
cateID.innerHTML="Loading..."
}
else
{
cateID.style.display="none";
}
}

functionShowAllList(Order,LeftNumber,TagName){
varobj=document.getElementsByTagName(TagName)

for(a=0;a<obj.length;a++)
{
if(obj[a].className=="SiteList")
{
obj2=obj[a].id;
varID=obj2.replace("Cate","");
varcateID=document.getElementById(obj2);
setdisplay2(cateID);
if(cateID.style.display=="")
{
varurl2="INCLUDE/GetSiteListFunction.asp?ID="+ID+"&Order="+Order+"&LeftNumber="+LeftNumber+"&r="+Math.random();
makeRequest(url2,cateID);
}
else
{
varurl2="INCLUDE/GetSiteListFunction.asp?ID="+ID+"&RemoveID=1&r="+Math.random();
makeRequest(url2,cateID);
}

}

}

if(ShowAllListFlag==1)
{
ShowAllListFlag=2;
}
else
{
ShowAllListFlag=1;
}

}

functionExpandListBySession(Str,Order,LeftNumber){
try{
varExpandList=Str.split("|");

for(b=0;b<ExpandList.length-1;b++)
{
setCatlog(ExpandList[b],Order,LeftNumber)
}
}catch(e){}

}

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章