开发者

How to get element ID from Iframes in Firefox?

I have the code below to get an element by ID. How to change this code to work cross-browser? Please help me.

var home = window.document.frames["ifrmmain"].document.frames["ifrmchild"].document.getEleme开发者_Python百科ntById("tdHome");

var homeLink = top.document.frames["ifrmmain"].tdHomeLink;


Put id attributes on your iframe tags, and replace document with contentDocument when accessing the document of a frame. For example:

var home = document.getElementById('ifrmmain').contentDocument.getElementById('ifrmchild').contentDocument.getElementById("tdHome");


window.frames[0].document.getElementById('btnSave').click();
or window.frames['iframename'].document.getElementById('btnSave').click();

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜