当前位置: 代码迷 >> Web前端 >> iframe父类与子类其间函数调用
  详细解决方案

iframe父类与子类其间函数调用

热度:61   发布时间:2012-11-04 10:42:42.0
iframe父类与子类之间函数调用
子页面调用父类JavaScript
1:window.top //最顶层窗口
2:window.self //当前窗口
3:window.parent //父级窗口
iframe父页调用子页函数:
主页:

父页面:t1.jsp
<iframe    name=a1    id=iframe1    src="t2.asp"></iframe>  
   <input    type=button    value=button1    name=button1  
   onclick="a1.window.Test()">  

子页面t2.jsp:

<script>  
  function Test(){  
    alert("TEST");  
  }  
</script>

  相关解决方案