摘要:iframe子視窗關閉母視窗
test3.php
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Ai-Life</title>
<style>
</style>
<script src="jquery-1.2.6.pack.js" ></script>
<script type="text/javascript">
function show()
{
//str = document.frames("iframeElement").txt.value;
alert("oak");
}
</script>
</head>
<body>
<div id="main" >
<iframe name="iframeElement" id="iframeElement" src="test2.php" >55555</iframe>
<button id="abc" onClick="show()" >show</button>
<input type="text" id="show" />
</div>
</body>
</html>
test2.php
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Ai-Life後台管理</title>
<style>
#photo{overflow-y:scroll;}
</style>
<script src="jquery-1.4.4.min.js" ></script>
<script type="text/javascript">
function show()
{
txt = window.parent.document.getElementById("main").style.display = 'none';
alert(txt);
}
</script>
</head>
<body>
This is a book.
<div id="man" >55555</div>
<input type="text" id="txt" />
<input type="button" onClick="show()" value="ok" />
</body>
</html>