您的位置:首页 > Web前端 > JavaScript

iframe中子页面调用父页面的js方法

2010-05-06 09:49 295 查看
有两个页面

client.html

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
function a(){
alert('frame子窗体调用父窗体方法');
}
</script>
</head>

<body>
<iframe name="main" style="width:40px; height:40px; border:0px;" scrolling="no" src="blank.html" ></iframe>
<a href="server.html" target="main" >js remote </a>
</body>
</html>

server.html

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
阿里山的肌肤 撒旦飞爱上地方撒地方撒 反对撒
撒地方撒
<script type="text/javascript">
window.parent.a();
</script>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: