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);
}
}
}
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);
}
}
}
解决方案 »
- Jquery 全选、取消
- happy002为倒分事件对大家道歉~
- Css属性存在性判断问题?
- 请问在下面的的代码中如何修改可以实现点击后改变图片吗?还请各位大师多多指教,拜拖哪....
- 求推荐一插件
- 关于Highcharts categories
- 移动图片的JAVASCRIPT,急求,谢谢
- 对已经打开的showmodaldialog使其能够center(此dialog高度和宽度都已经改变)
- JS能做出显示本地硬盘目录的窗口,选中目录后确定,显示在一个文本框里的效果吗?
- 请问在javascript中,假定有一个变量定义为:var a = "技术问题";在同样的一个javascript中,如何将a转变为是以英文编码为标准的字符,同
- 输入框验证问题。急,急!!!!!!!急!!!!!!!!
- jqueryeasyui中的datagrid如何实现横向排版
xmlhttp.open("get", "WebForm3.aspx?ID="+name, false);
但是xmlhttp.open(get,url,true)的话就会执行,但是ashx还没有执行就已经触发了相应事件,导致获得的responseText为空。 最后一个参数应该是是否同步的,搞不懂。