sadier

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

//查询是否需要弹出用户树,当没有分类或非组分类时不需弹出
function ChkCategoryID(CatID)
{
 
 if (CatID == "")
 {
  alert("请先选择分类!");
  return false;
 }
 
 var SoapBody = "<CatID>";
 SoapBody += CatID;
 SoapBody += "</CatID>";
 
 var url = "../Common/JumpWebService.asmx";
 var MethodName = "ChkIsGroupByCatID";
 var result = RemoteRun(url, MethodName, SoapBody);

 if( result == "true")
 {
  //可以显示树
 }
 else
 {
  alert("公开分类的对象为全体,个人分类的对象为作者本身,不需指定对象!");
  return false;
 }
 return true; 
}



function RemoteRun(page, Method, SoapBody)
{
 var url = page + "?methodname=" + Method;
 var xmlhttp,dom,node,xmlDOC;
 
 var SoapHead = "<?xml version='1.0' encoding='utf-8'?>" +
     "<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'><soap:Body><" + Method + " xmlns='http://localhost'>";
 var SoapTail = "</" + Method + "></soap:Body></soap:Envelope>";

 var SoapRequest = SoapHead + SoapBody + SoapTail;
 
 xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 xmlhttp.Open("POST",url,false);
 xmlhttp.setRequestHeader("Content-Type", "text/xml;charset=utf-8");
 xmlhttp.setRequestHeader("SOAPAction", "http://localhost/"+Method);
 xmlhttp.setRequestHeader("Content-Length",SoapRequest.length);
 xmlhttp.Send(SoapRequest);
 
 if( xmlhttp.Status == 200 )
 {
  var result = xmlhttp.responseXML.getElementsByTagName(Method + "Result");
  if(result)
  {
   return result(0).text;
  }
 }

 return "失败,请检查网络是否通畅。";
}

posted on 2005-03-01 18:13  毛小华  阅读(1630)  评论(0编辑  收藏  举报