日期:2014-05-18  浏览次数:20652 次

怎样获得frame中的document接口
我有一段代码,如下:
<script   language= "javascript ">
  function   init()
{
document.getElementById( "frmcontent ").document.onmousemove=function(){alert( "moving ");};
  }
</script>

<frameset   rows= "90,* "   cols= "* "   frameborder= "1 "onLoad= "init(); ">
  <frame   src= "topframe.html "   scrolling= "no "   noresize= "true ">
  <frame   id= "frmcontent "   name= "frmcontent "         src= "http://www.baidu.com ">
</frameset>

我想取得frmcontent的document接口,并定义它的onmousemove行为。请问该怎么做呢?

------解决方案--------------------
如果是本页面调用可以用self.frames[1] 子frame调用用parent的frames数组 指定下标就可以