本文介绍了其他框架中的javascript document.getElementById的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我有2个框架,想要从一个框架到另一个框架的元素访问:

so, I have 2 frames and want to access to element from one frame into another :

框架1:

<div id='someId'>...</div>

框架2:

var div=document.getElementById('someId');

div.innerHTML='something';

这在某种程度上在Firefox中不起作用,所以我想确保,我可以访问另一个元素框架的ID?

this is somehow not functioning in Firefox so I want to be sure, can I access to element in another frame by its ID ?

推荐答案

您可以使用

window.frames["framename"]

然后你可以参考元素在DOM中使用

and then you can refer the element in the DOM by using

window.frames["framename"].document.getElementById ( "yourelementid" );

这篇关于其他框架中的javascript document.getElementById的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 05:54
查看更多