JS中的top是什么?

<iframe/>或者<frame>里面用主页面的东西,就是top.xxx

如:
<script>
  function func(){ ... };
</script>
<input type='text' id='t' />
<iframe scr='a.html'/>

//a.html简单内容如下
<script>
top.document.getElementById('t').value; //在a.html中取input的值
top.func(); //在a.html中执行func()
</script>
原文地址:https://www.cnblogs.com/jieliujas/p/8961236.html