1.在父页面中用js弹出模态子页面:window.showModalDialog(url,window,"dialogWidth:" + Width + "px;dialogHeight:" + Height + "px;center:yes;status:no;scroll:yes;help:no;location=no");
2.在子页面加载(onload事件)的时候需要根据父页面的参数去查询数据,这个时候子页面用的是ajax,但是始终没有触发状态改变,子页面的js根本没有弹出任何一个alert。    var sData = dialogArguments;
    var father_Row= sData.getNewData('cur');
    if(father_Row!=null)
    {
     var name=  document.getElementById("name");
     name.value= father_Row.cells(1).innerText;
     
    var xmlhttp;
            try {
                xmlhttp = new XMLHttpRequest();
            } catch (e) {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
     
            xmlhttp.open("get", "WebForm3.aspx?ID="+name, false);
            xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
            //xmlhttp.setRequestHeader("If-Modified-Since","0");
            xmlhttp.send("");
 
            xmlhttp.onreadystatechange = function() {
                if (4 == xmlhttp.readyState) {
                    if (200 == xmlhttp.status) {
                        var Bodys = xmlhttp.responseText; 
                       
                      alert("获得内容:"+Bodys);
                      var div1=  document.getElementById("div1");
                      div1.innerHTML=Bodys;
                  }
                  else
                  {
                       alert(xmlhttp.status);
                  }
               }
               else
               {
                       alert(xmlhttp.readyState);
               }
            }
    }

解决方案 »

  1.   

    这个自己调式嘛,总会用firebug吧,总会用alert吧,你在发出请求之间alert啊,看看请求发出去了没,都什么命名嘛 Id还名称成name 你不知道表单元素也有name属性吗?然后也不是每个浏览器都支持innerText
      

  2.   

    自己单步调试吧。 var name=  document.getElementById("name");
    xmlhttp.open("get", "WebForm3.aspx?ID="+name, false);
      

  3.   

    不是这个问题,您的意思是name.value 这个地方没有问题的,我输入错了了而已。主要是我有一个疑问:在xmlhttp.open(get,url,false)时的确没有触发任何函数,没有弹出任何alert,
    但是xmlhttp.open(get,url,true)的话就会执行,但是ashx还没有执行就已经触发了相应事件,导致获得的responseText为空。 最后一个参数应该是是否同步的,搞不懂。
      

  4.   

    为什么同步(false)的时候 就不行了呢?求高手解答