通常IE 和火狐比较支持,貌似谷歌不是很好使,要是有更好的方法希望回帖!

testFrame.html

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test Iframe</title>
</head>
<body>
<Iframe name="tt" src="frame1.html" width="200" height="200" scrolling="no" frameborder="0"></iframe>
<h1 id="myH2" >hello,my wife</h1>
</body>
</html>



frame1.html


<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<script type="text/javascript">
function loadUI() {
var txt = parent.document.getElementById("myH2");
alert(txt.textContent);
}
</script>
</head>

<body>
<button value="btn" onClick="loadUI();"> button</button>
</body>
</html>