最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501
当前位置: 首页 - 科技 - 知识百科 - 正文

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

来源:懂视网 责编:小采 时间:2020-11-27 22:52:51
文档

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

ajax.js里面有内容显示效果,根据ID:ajax.js里面有内容显示效果,根据ID 代码如下: var http_request = false; var success=false; var ShowAllListFlag=1; var DisplayArticle=true; function makeRequest(url,cateID) { http_reques
推荐度:
导读ajax.js里面有内容显示效果,根据ID:ajax.js里面有内容显示效果,根据ID 代码如下: var http_request = false; var success=false; var ShowAllListFlag=1; var DisplayArticle=true; function makeRequest(url,cateID) { http_reques

ajax.js里面有内容显示效果,根据ID
代码如下:
    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) {}

    }

声明:本网页内容旨在传播知识,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文档

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

ajax.js里面有内容显示效果,根据ID:ajax.js里面有内容显示效果,根据ID 代码如下: var http_request = false; var success=false; var ShowAllListFlag=1; var DisplayArticle=true; function makeRequest(url,cateID) { http_reques
推荐度:
标签: 显示 id 内容
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top