日期:2014-05-16  浏览次数:20365 次

怎样实现点击另一框架内的按钮
frame1内有一个按钮botton1,点击该按钮后,怎样实现点击另一框架内的按钮
botton2;
window.top.document.getElementById( 'frame2 ').botton2.click();
这样写不行   该怎么改呢?

------解决方案--------------------
window.top.frames[ "rightFrame "].document.getElementById( "b ").click();

window.top.frames[ "rightFrame "]这个是到另外那个框架中.
然后后边和在本页中的调用一样

document.getElementById( "b ").click();
b 是button2的id号.

------解决方案--------------------
Try this...

Index.html
-----------------------------
<frameset cols= "100,* ">
<frame src= "a.html " name= "left " />
<frame src= "b.html " name= "right " />
</frameset>


a.html
-----------------------------------
<input type= "button " value= "a button " onclick= "parent.right.document.getElementById( 'b ').click() ">


b.html
------------------------------------
<input type= "button " name= "b " value= "b button " onclick= "alert( 'B Button Clicked ') ">