您现在的位置是:首页 > 电脑技术查询 > web开发

怎样从一个子frame中取得另一个子frame中的标签?该怎么处理

编辑:chaxungu时间:2022-10-02 23:17:31分类:web开发

怎样从一个子frame中取得另一个子frame中的标签?
框架页面定义:
<frameset rows="*" cols="200,*" framespacing="1" frameborder="yes" border="1">
<frame src="left.htm" name="leftFrame" scrolling="auto" >
<frame src="main.htm" name="mainFrame">
</frameset>

main.htm里定义
<body> <div id="testdiv" ></div>
</body>现在想在leftFrame中通过document.getElementById(testdiv)取得mainFrame的testdiv。该如何写呢?谢谢!

------解决方案--------------------
top.mainFrame.document.getElementById("testdiv")