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) {}
}