开发者

How to get element ID from Iframes in Firefox?

开发者 https://www.devze.com 2023-03-27 15:42 出处:网络
I have the code below to get an element by ID. How to change this code to work cross-browser? Please help me.

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

精彩评论

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

关注公众号