IE 9 Javascript Window Variable 为 null.适用于IE 8
IE 9 Javascript Window Variable is null.. Works on IE 8
在我的代码中的某个时刻,我以这种方式访问一个javascript变量:
var DASHBOARD = document.parentWindow.parent.Dashboard;
其中 parent 的值是 {object Window},其类型是 DispHTMLWindow2。它在IE8或IE9兼容性视图中工作正常,但是当我无法使其在IE9上工作时。
在IE9上,document.parentWindow.parent.Dashboard的值是未定义的,其类型是Undefined的。我还注意到 parent 的值是 {...},它在 IE 9 上的类型是 [对象,窗口]。
在IE 9中是否有其他方法可以访问变量仪表板?
例:
布局.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Create new Layout</title>
<style type="text/css">
.border-top { height: 5px; background-color: #B2B2B2;}
.border-left { width: 3px; height: 100%; background-color: #B2B2B2;}
.content { height: 100%; background-color: #FFFFFF;}
</style>
<script type="text/javascript" src="./container/includes/js/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="./container/includes/js/jquery-ui-1.8.12.custom.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
var dada = "123";
});
</script>
</head>
<body>
<form id="form1" runat="server" style="width: 100%; height: 100%;">
<div style="width: 100%; height: 100%;">
<iframe name="remote_iframe_0" src="layouts2.aspx" id="remote_iframe_0" />
</div>
</form>
</body>
</html>
布局2.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.border-top { height: 5px; background-color: #B2B2B2;}
.border-left { width: 3px; height: 100%; background-color: #B2B2B2;}
.content { height: 100%; background-color: #FFFFFF;}
</style>
<script type="text/javascript" src="./container/includes/js/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="./container/includes/js/jquery-ui-1.8.12.custom.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
debugger;
});
</script>
</head>
<body>
<form id="form1" runat="server" style="width: 100%; height: 100%;">
<div style="width: 100%; height: 100%;">
AAAA
</div>
</form>
</body>
</html>
如何在调试器中访问变量 dada;在布局中2.aspx?考虑到两个页面位于同一域中。
您可以使用:
window.parent.dada
参考:
http://w3schools.com/jsref/obj_window.asp
http://w3schools.com/jsref/dom_obj_document.asp
相关文章:
- 无法获取属性'字符串'的未定义或null引用IE 11 ASP.NET
- onmousemove=null不会'我不在IE工作
- IE错误:无法设置属性'的值;样式':对象为null或未定义
- IE:无法获取属性'的值;clientWidth':对象为null或未定义
- IE 0.width为null或不是对象
- IE 9 Javascript Window Variable 为 null.适用于IE 8
- GetElementById 在 IE 中返回 null
- Javascript 对象在 IE 中为 null 或不是 object
- 在 IE 中设置 srcElement 会导致 null
- 重复警报“;来自网页的消息:null”;在IE中
- 对window.open()的调用在IE 11+Windows 8.1预览版上返回null
- 删除、忽略或阻止IE中字符串中的null字符
- IE,Edge将存储文本替换为'null'
- IE 8中的jQuery错误:消息:'this.0.ownerDocument.body'为null或不
- AJAX: responseXML is null in IE 11
- IE 10-无法获取属性'PageRequestManager'的未定义引用或null引用:
- IE AJAX响应在Null(0x00)字符后修剪所有数据
- 所有版本的IE返回SCRIPT5007无法获取属性'长度'的未定义引用或null引用
- 用于IE的xml解析器不起作用.loadXML返回null
- IE错误'是null或者不是一个对象