服务器接受一切正常但是向客户端发送就不可以客户端接的函数接受到了服务器发送的东西但是里面没有值接受部分     function complete()
       {
if (req.readyState == 4)
{
         if (xmlObj.status == 200)
           {
         var type = req.responseXML.getElementsByTagName("ccc");
         if(type.length>0)
           {
             alert("111")
           }
            }
         }服务器部分            Dim conn_Type As String = "text/xml; charset=gb2312"
            Me.Response.ContentType = conn_Type
            Me.Response.Output.Write("<ccc>eee</ccc>")
            Me.Response.Close()客户端的complete(如果只写一个alert可以跳出)是走的,但是里面的值却没有type.length=0

解决方案 »

  1.   

    我也遇到这个问题!我得帖子:http://community.csdn.net/Expert/topic/4551/4551082.xml?temp=6.541079E-02
      

  2.   

    先看是不是Text,然后再试着分析xml,一步一步来
    标准测试页
    <HTML>
    <HEAD>
    <META http-equiv='Content-Type' content='text/html;charset=gb2312'>
    <Meta name='Gemeratpr' content='网络程序员伴侣(Lshdic)2005'>
    <TITLE></TITLE>
    <SCRIPT language=jscript type='text/jscript' >
    function getXMLRequester( ){
      var xmlhttp_request = false;
      try{
      if( window.ActiveXObject ){
      for( var i = 5; i; i-- ){
      try{
      if( i == 2 ){
      xmlhttp_request = new ActiveXObject( "Microsoft.XMLHTTP" );
      }else{
      xmlhttp_request = new ActiveXObject( "Msxml2.XMLHTTP." + i + ".0" );
    xmlhttp_request.setRequestHeader("Content-Type", "text/xml;charset=utf-8");
      }
      break;}
      catch(e){
      xmlhttp_request = false;
      }
      }
      }else if( window.XMLHttpRequest ){
      xmlhttp_request = new XMLHttpRequest();
      if (xmlhttp_request.overrideMimeType) {
      xmlhttp_request.overrideMimeType('text/xml');
      }
      }
      }catch(e){
      xmlhttp_request = false;
      }
      return xmlhttp_request ;
      }
    var req;
    function sendRequest(url,method, HttpMethod, params) { url += "/" + method;
    message.value = url;
      if (!HttpMethod){
        HttpMethod = "POST";  
      }  
      req = getXMLRequester();
      button1.disabled = true;
      if (req) {
        req.onreadystatechange = processReqChange;//调用doContents函数
        req.open(HttpMethod, url, true);
    req.setRequestHeader("Host", "202.115.138.116");
    req.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
    //req.setRequestHeader("SOAPAction", "http://localhost/"+method); 
    req.setRequestHeader("Content-Length",params.length); 
    req.send(params);
      }
    }function processReqChange() {
        // 监视数据传递。
        if (req.readyState == 4) {        if (req.status == 200) {
                HttpResponse();        // connect OK
             } else {
                alert("无法正常连接服务器,错误:\n" +
                    req.statusText+":"+req.status);
             }
        }
    }function HttpResponse() {

    message.value = req.responseText;
      button1.disabled = false;
    }</SCRIPT>
    </HEAD>
    <BODY>
    <textarea id='send' value='' rows='2' style='width:100;' ></textarea>
    <INPUT id='button1' type='button' value='sdfsdf' onclick='sendRequest("http://202.115.138.116/shiyanservice/Service.asmx","HelloWorld","POST","aa="+send.value);' />
    <textarea id='message' value='' rows='8' style='width:500;' ></textarea>
    </BODY>
    </HTML>http://do-net.xicp.net
    .NET技术群
    QQ群4329404可加,4329478满,7019839满,10058555管理员不在
    MSN群138459
    ---------------------------------------------------------
    个人QQ303864496
    msn:[email protected]
    成都理工大三,寻成都地区兼职,熟悉asp.net/C#/webservice
    NeT(Nebula Team)结交愿意郑州发展的.net技术朋友(19-25岁)...
    email:[email protected]
    有事直接联系,我一般不会二次浏览一个帖子。
      

  3.   

    将 Dim conn_Type As String = "text/xml; charset=gb2312"
    修改为:Dim conn_Type As String = "text/xml";就可以了。