﻿//********************************************************//
//        GetXmlHttpOject() 返回一个xmlHttpRequest对象    //
//        ShowCalender(url)   显示主要的弹出是窗口        //
//                       url请求页面的地址                //
//         ShowWorkInfo(url)                              //
//                        url请求页面的地址               //
//********************************************************//

//定义xmlHttpRequest对象
function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)

  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

//****************************************************************//
//  函数 ShowContent()
//       参数 div 显示在后台获取的数据的div标签ID
//            url 请求的页面
//
var xmlHttpRequest;
var sDIV;
function ShowContent(div,url)
{
    
   sDIV=document.getElementById(div);
   xmlHttpRequest=GetXmlHttpObject();
   
   if(xmlHttpRequest==null)
   {
       alert("你的游览器不支持ajax\r\n系统不能正常的使用\r\n推荐你使用IE6.0以上的版本");
       return;
   }
   else 
   {
     //设置xmlHttpRequest对象的回调函数
     xmlHttpRequest.onreadystatechange=stateChangedContent;
     xmlHttpRequest.open("GET",url,true);
     xmlHttpRequest.send(null);
   }
}
//回调函数stateChangContent的定义   
function stateChangedContent()
{ 
if (xmlHttpRequest.readyState==4)
{
   sDIV.innerHTML=xmlHttpRequest.responseText; 
  }
else
   sDIV.innerHTML=" <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"width: 100px\"><tr><td><img src=\"/Images/loading.gif\" /></td><td align=\"left\" style=\"font-size: 12px; width: 80px; color: #999999\">加载内容……</td></tr></table>";
}