当点击 button 的时候 只弹出 a, 没弹出b,
我用的是opensuse11 linux apach2 服务器<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head>
<meta http-equiv="content-type"
content="application/xhtml+xml; charset=utf-8" />
<script type='text/javascript'>function a(){ var oIframe = document.getElementById("myframe"); var oDoc = oIframe.contentWindow || oIframe.contentDocument; alert("a");
if (oDoc.document) {
oDoc = oDoc.document;
}
alert("b");
oDoc.body.style.backgroundColor = "#00f";
}
</script>
</head>
<body><iframe name="myframe" id="myframe" src ="http://www.google.co.uk" width="100%" height="300">
<p>Your browser does not support iframes.</p>
</iframe><button onclick='a()'>get</button>
</body>
</html>
我用的是opensuse11 linux apach2 服务器<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head>
<meta http-equiv="content-type"
content="application/xhtml+xml; charset=utf-8" />
<script type='text/javascript'>function a(){ var oIframe = document.getElementById("myframe"); var oDoc = oIframe.contentWindow || oIframe.contentDocument; alert("a");
if (oDoc.document) {
oDoc = oDoc.document;
}
alert("b");
oDoc.body.style.backgroundColor = "#00f";
}
</script>
</head>
<body><iframe name="myframe" id="myframe" src ="http://www.google.co.uk" width="100%" height="300">
<p>Your browser does not support iframes.</p>
</iframe><button onclick='a()'>get</button>
</body>
</html>
解决方案 »
- 新手求助!使用jquery查找元素的时候没有结果,怎么办?
- 函数的apply方法问题
- 如何使用javascript使用方向键控制光标在table单元格的输入框的中跳动。
- fs2.nsns[0],fs1.nsns[1],fs.nsns[0]搜中文是乱码怎么解决
- javastript 隐藏与显示
- 请问一个string 处理的问题 请大侠指点
- iframe中的页面自身提交到自身,还在当前的iframe中显示,该怎么写
- firefox怎么把input type=file节点添加到form节点下
- 怎样在选择文本后自动复制文本?
- cannot read property 'layer' of null
- form1.submit()不执行的问题
- jquery样式问题
http://www.google.co.uk改为同域名下的文件就可以了
不能执行到
ALERT("b");