var objInfo=oGrid.GetCurrent(true);
var projectno=objInfo["pjhd_cProjectNo"];
var productid=objInfo["pjpd_cProductID"];
window.parent.parent.frames["menu"].insertTab('預排排期','../CD/GetCenterInfo.aspx');
var prePlanWindow=window.parent.document.getElementById('frm_預排排期').contentWindow;
prePlanWindow.document.getElementById("prm_cProjectNo_").value=projectno;
prePlanWindow.document.getElementById("prm_cProductID_").value=productid;
prePlanWindow.document.getElementById("btn_Search_").click();上面是我的js,说明一下,projectno和productid的取值没问题
下面的insertTab是在窗口插入一个新的tab,如果已存在就打开这个tab,每个tab以iframe的形式存在div里,如果点击这个tab就隐藏其他div,显示这个div。
prePlanWindow可以取到值,就是window GetCenterInfo.aspx,当没有这个tab的时候,在IE下最后三行脚本都会报错,说是getElementById取不到值;有这个tab的时候正常可以运行。
用firefox 去调试,一步步的跟下来没有问题,但是在firefox下直接运行依然是最后三行脚本都会报错。
感觉上好像浏览器执行脚本时不是像调试时每步都会有结果?为什么我一步步调试的时候就不会报错?
下面是html,三个div分别是三个tab。问题总结就是要在prePlanWindow这个值的相应div已经存在时上面的脚本才能正常运行,而insertTab执行的也是当没有这个div时就插入这个div,为什么还是不行呢?
<frame scrolling="no" src="WebUI/Page.aspx" noresize="" marginheight="0" marginwidth="0" name="page" id="page">
<html xmlns="http://www.w3.org/1999/xhtml"><head id="Head1">body style="margin: 0px;">
<form id="form1" action="Page.aspx" method="post" name="form1"><div id="控制台" style="display: none;">
<iframe width="100%" height="100%" frameborder="0" scrolling="auto" style="border-left: 1px solid rgb(101, 147, 207); border-right: 1px solid rgb(101, 147, 207); border-bottom: 1px solid rgb(101, 147, 207);" src="../WebUI/Desktop.aspx" background="../bkground.gif" id="frm_控制台"></iframe></div><div id="調度查詢中心" style="display: none;"><iframe width="100%" height="100%" frameborder="0" scrolling="auto" style="border-left: 1px solid rgb(101, 147, 207); border-right: 1px solid rgb(101, 147, 207); border-bottom: 1px solid rgb(101, 147, 207);" src="../CD/SearchCenterList.aspx" background="../bkground.gif" id="frm_調度查詢中心"></iframe></div><div id="預排排期"><iframe width="100%" height="100%" frameborder="0" scrolling="auto" style="border-left: 1px solid rgb(101, 147, 207); border-right: 1px solid rgb(101, 147, 207); border-bottom: 1px solid rgb(101, 147, 207);" src="../CD/GetCenterInfo.aspx" background="../bkground.gif" id="frm_預排排期"></iframe></div></form>
</body></html>
</frame>
var projectno=objInfo["pjhd_cProjectNo"];
var productid=objInfo["pjpd_cProductID"];
window.parent.parent.frames["menu"].insertTab('預排排期','../CD/GetCenterInfo.aspx');
var prePlanWindow=window.parent.document.getElementById('frm_預排排期').contentWindow;
prePlanWindow.document.getElementById("prm_cProjectNo_").value=projectno;
prePlanWindow.document.getElementById("prm_cProductID_").value=productid;
prePlanWindow.document.getElementById("btn_Search_").click();上面是我的js,说明一下,projectno和productid的取值没问题
下面的insertTab是在窗口插入一个新的tab,如果已存在就打开这个tab,每个tab以iframe的形式存在div里,如果点击这个tab就隐藏其他div,显示这个div。
prePlanWindow可以取到值,就是window GetCenterInfo.aspx,当没有这个tab的时候,在IE下最后三行脚本都会报错,说是getElementById取不到值;有这个tab的时候正常可以运行。
用firefox 去调试,一步步的跟下来没有问题,但是在firefox下直接运行依然是最后三行脚本都会报错。
感觉上好像浏览器执行脚本时不是像调试时每步都会有结果?为什么我一步步调试的时候就不会报错?
下面是html,三个div分别是三个tab。问题总结就是要在prePlanWindow这个值的相应div已经存在时上面的脚本才能正常运行,而insertTab执行的也是当没有这个div时就插入这个div,为什么还是不行呢?
<frame scrolling="no" src="WebUI/Page.aspx" noresize="" marginheight="0" marginwidth="0" name="page" id="page">
<html xmlns="http://www.w3.org/1999/xhtml"><head id="Head1">body style="margin: 0px;">
<form id="form1" action="Page.aspx" method="post" name="form1"><div id="控制台" style="display: none;">
<iframe width="100%" height="100%" frameborder="0" scrolling="auto" style="border-left: 1px solid rgb(101, 147, 207); border-right: 1px solid rgb(101, 147, 207); border-bottom: 1px solid rgb(101, 147, 207);" src="../WebUI/Desktop.aspx" background="../bkground.gif" id="frm_控制台"></iframe></div><div id="調度查詢中心" style="display: none;"><iframe width="100%" height="100%" frameborder="0" scrolling="auto" style="border-left: 1px solid rgb(101, 147, 207); border-right: 1px solid rgb(101, 147, 207); border-bottom: 1px solid rgb(101, 147, 207);" src="../CD/SearchCenterList.aspx" background="../bkground.gif" id="frm_調度查詢中心"></iframe></div><div id="預排排期"><iframe width="100%" height="100%" frameborder="0" scrolling="auto" style="border-left: 1px solid rgb(101, 147, 207); border-right: 1px solid rgb(101, 147, 207); border-bottom: 1px solid rgb(101, 147, 207);" src="../CD/GetCenterInfo.aspx" background="../bkground.gif" id="frm_預排排期"></iframe></div></form>
</body></html>
</frame>
解决方案 »
- 浏览器兼容问题
- 求一个简单的jq换js代码
- 如何将图片的热点功能存成一JS文件,在其他网页直接调用
- 请教js实现 窗口最小化(ie7)
- 关于javascript 计算radio的值的问题
- 在线求助:如果利用Javascript在静态页面中获得点击来源网页地址?
- 如何结合JAVASCRIPT读取表格中的数据呢?
- 在窗口关闭事件中,其他代码不能执行!!请指教..
- 一个简单关于参数传递的问题!
- 请问在javascript中,假定有一个变量定义为:var a = "技术问题";在同样的一个javascript中,如何将a转变为是以英文编码为标准的字符,同
- firefox和Chrome的alert怎么用。
- 高问题 请进
设断点,这步后在直接运行就ok,在这步执行之前直接运行就报错
var prePlanWindow=window.parent.document.getElementById('frm_預排排期').contentWindow;
后面加个alter,可以正常
有没有高手能根据这个解释一下js代码是怎么运行的呢?我是菜鸟···不懂原理
就是不知道有什么语句可以延时的·求教啊