Maison >interface Web >js tutoriel >javascript 获取iframe里页面中元素值的方法_javascript技巧
IE方法:
document.frames['myFrame'].document.getElementById('test').value;
火狐方法:
document.getElementById('myFrame').contentWindow.document.getElementById('test').value;
IE、火狐方法:
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);
}