IE方法:
document.frames['myframe'].document.getElementById('test').value;
火狐方法:
document.getElementById('myframe').contentWindow.document.getElementById('test').value;
IE、火狐方法:
复制代码 代码如下:
function getValue(){
var tmp = '';
if(document.frames){
tmp += 'ie哥说:';
tmp += document.frames['myframe'].document.getElementById('test').value;
}else{
tmp = document.getElementById('myframe').contentWindow.document.getElementById('test').value;
}
alert(tmp);
}
示例代码:
a.html页面中的代码
复制代码 代码如下:
javascript 获取iframe里页面中元素的值 测试
b.html页面中的代码
复制代码 代码如下:
我是 iframe内的页面



