Ajax. js contains the content display effect, according to the ID
Copy codeThe Code is as follows:
Var http_request = false;
Var success = false;
Var ShowAllListFlag = 1;
Var DisplayArticle = true;
Function makeRequest (url, cateID ){
Http_request = false;
If (window. XMLHttpRequest) {// Mozilla, Safari ,...
Http_request = new XMLHttpRequest ();
If (http_request.overrideMimeType ){
Http_request.overrideMimeType ('text/xml ');
}
} Else if (window. ActiveXObject) {// IE
Try {
Http_request = new ActiveXObject ("Msxml2.XMLHTTP ");
} Catch (e ){
Try {
Http_request = new ActiveXObject ("Microsoft. XMLHTTP ");
} Catch (e ){}
}
}
If (! Http_request ){
Alert ('Giving up :( Cannot create an XMLHTTP instance ');
Return false;
}
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;
}
}
Function alertContents (){
If (http_request.readyState = 4 ){
If (http_request.status = 200 ){
Success = true;
} Else {
Alert ('There was a problem with the request .');
}
}
}
Function setCatlog (ID, Order, LeftNumber ){
Var cateID = document. getElementById ('cate' + ID );
Setdisplay (cateID );
If (cateID. style. display = "")
{
Var url2 = "INCLUDE/GetSiteListFunction. asp? ID = "+ ID +" & Order = "+ Order +" & LeftNumber = "+ LeftNumber +" & r = "+ Math. random ();
MakeRequest (url2, cateID );
}
Else
{
Var url2 = "INCLUDE/GetSiteListFunction. asp? ID = "+ ID +" & RemoveID = 1 & r = "+ Math. random ();
MakeRequest (url2, cateID );
}
}
Function setArticleList (EncodeURL, ArticleID ){
If (DisplayArticle = true)
{
Try {var objArticleIDtop = document. getElementById ('top' + ArticleID );
Var objArticleIDbottom = 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 ")
{
Var url2 = "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
{
}
}
Function DisplayContent (ArticleID ){
If (DisplayArticle = true)
{
Try {var objArticleIDtop = document. getElementById ('top' + ArticleID );
Var objArticleIDbottom = 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
{
}
}
Function setdisplay (cateID ){
If (cateID. style. display = "none ")
{
CateID. style. display = "";
CateID. innerHTML = "Loading ..."
}
Else
{
CateID. style. display = "none ";
}
}
Function setdisplay2 (cateID ){
If (ShowAllListFlag = 1)
{
CateID. style. display = "";
CateID. innerHTML = "Loading ..."
}
Else
{
CateID. style. display = "none ";
}
}
Function ShowAllList (Order, LeftNumber, TagName ){
Var obj = document. getElementsByTagName (TagName)
For (a = 0; a <obj. length; a ++)
{
If (obj [a]. className = "SiteList ")
{
Obj2 = obj [a]. id;
Var ID = obj2.replace ("Cate ","");
Var cateID = document. getElementById (obj2 );
Setdisplay2 (cateID );
If (cateID. style. display = "")
{
Var url2 = "INCLUDE/GetSiteListFunction. asp? ID = "+ ID +" & Order = "+ Order +" & LeftNumber = "+ LeftNumber +" & r = "+ Math. random ();
MakeRequest (url2, cateID );
}
Else
{
Var url2 = "INCLUDE/GetSiteListFunction. asp? ID = "+ ID +" & RemoveID = 1 & r = "+ Math. random ();
MakeRequest (url2, cateID );
}
}
}
If (ShowAllListFlag = 1)
{
ShowAllListFlag = 2;
}
Else
{
ShowAllListFlag = 1;
}
}
Function ExpandListBySession (Str, Order, LeftNumber ){
Try {
Var ExpandList = Str. split ("| ");
For (B = 0; B <ExpandList. length-1; B ++)
{
SetCatlog (ExpandList [B], Order, LeftNumber)
}
} Catch (e ){}
}