www.gusucode.com > YulinCMS 雨林内容管理系统 2.0源码程序 > Admin/JS/Admin.js

    
function hideTree()
{
	top.workPanel.cols="0,*";
	top.topPanel.document.all('tree').style.display="block";
	
}
	
function syncTree()
{
	top.leftPanel.location = top.leftPanel.location;
}


function showTree(obj)
{
	top.workPanel.cols = "200,*";
	obj.style.display = "none";
}

function doClick(action)
{
	var url;
	if(top.leftPanel.location.href.indexOf('?')==-1)
	{
		url = top.leftPanel.location.href.substring(0);
	}
	else
	{
		url = top.leftPanel.location.href.substring(0,top.leftPanel.location.href.indexOf("?"));
	}
	top.leftPanel.location=url+"?Action="+action;
	if(action=='')
	{
		top.mainPanel.location="Main.aspx";	
	}
}

function reloadLeftPannel()
{
    window.parent.frames['leftPanel'].location.reload();
}

function getXMLHttpRequest(){
    var request = false;
    try {
      request = new XMLHttpRequest();
    } catch (trymicrosoft) {
      try {
        request = new ActiveXObject("Msxml2.XMLHTTP");
      } catch (othermicrosoft) {
        try {
          request = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (failed) {
          request = false;
        }
      }
    }
    return request;
}

function getServerMessage(pageUrl,id) 
{
	var ch = "?";
	if (pageUrl.indexOf("?")>=0) ch="&";
    var xmlhttp = getXMLHttpRequest();
	if(!xmlhttp) return;
    var rand = parseInt(Math.random()*999999999999999);
    xmlhttp.open("GET",""+pageUrl+ch+"tmp="+rand,true);
    xmlhttp.onreadystatechange =  function(){
                if(xmlhttp.readyState==4 && xmlhttp.status==200 ){
                    document.getElementById(id).innerHTML = xmlhttp.responseText;
                }
            };
    xmlhttp.send(null);
}

function getServerMessageWithLoop(pageUrl,id,interval) 
{
    var xmlhttp = getXMLHttpRequest();
	if(!xmlhttp) return;
    var rand = parseInt(Math.random()*999999999999999);
    xmlhttp.open("GET",""+pageUrl+"?tmp="+rand,true);
    xmlhttp.onreadystatechange =  function(){
                if(xmlhttp.readyState==4 && xmlhttp.status==200 ){
                    document.getElementById(id).innerHTML = xmlhttp.responseText;
                    setTimeout("getServerMessageWithLoop('"+pageUrl+"','"+id+"',"+interval+")",interval);
                }
            };
    xmlhttp.send(null);
}