Ajax.js inside has the content display effect, according to the ID

Source: Internet
Author: User
Tags include tagname window
ajax|js| Display

Ajax.js inside has the content display effect, according to the ID
[Copy this Code] CODE:
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 is 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{
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{
Setcatlog (Expandlist[b],order,leftnumber)
}
catch (e) {}
}



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.