为什么无法取得iframe页面中的内容?
为什么无法取得iframe中的内容
代码如下。单击“get”按钮后,浏览器状态栏报告脚本错误。不知道为什么
<HTML>
<head>
<TITLE>HTML</TITLE>
<style>
</style>
<script language=javascript>
function iframeChange() {
HtmlFile1.location.href=url.value;
}
function gettext() {
document.all.form01.fhead1.value = "这里是个好地方!";
document.all.form01.fbody1.value = HtmlFile1.document.body.innerHTML;
}
</script>
</head>
<body>
<iframe ID="HtmlFile1" MARGINHEIGHT="1" MARGINWIDTH="1" width="80%" height="60%" scrolling="yes">
</iframe>
<br>
<input id=url type=text value="http://www.baidu.com";>
<input type=button value=" ok " onclick="iframeChange()">
<input type=button value=" get " onclick="gettext()">
<br>
<form name=form01>
<textarea name=fhead1 cols=50 rows=10></textarea>
<textarea name=fbody1 cols=50 rows=10></textarea>
</form>
</BODY>
</HTML>