Ajax. js contains the content display effect, according to the ID
CopyCode The 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 ){}
}