/    Sign up×
Community /Pin to ProfileBookmark

iframes in firefox

Error:

document.frames is not a function

Code:

document.frames(“frame1”).document.forms(“Form2”).submit();

iFrame:

<f:verbatim>
<iframe SRC=”https://site.com/
name=”frame1″ id=”frame1″
style=”width:100.0%; height:575.0px;” frameborder=”0″
width=”100%” scrolling=”auto”/>
</f:verbatim>

Is there a way to define the document.frames function for Firefox? I defined the .click() function like…

function defineClick(){
if(!window.event){
HTMLElement.prototype.click = function() {
var evt = this.ownerDocument.createEvent(‘MouseEvents’);
evt.initMouseEvent(‘click’, true, true, this.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
this.dispatchEvent(evt);
}
}
}

and it worked fine. Is there something similar?

Thanks,
[tim]

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@KorSep 04.2008 — The form's nested in an iframe reference should be:
<i>
</i>document.getElementById('frame1').contentWindow.document.forms['Form2']
Copy linkTweet thisAlerts:
@cgishackSep 04.2008 — Frames is an array[]

document.frames["frame1"].

Same with forms[]

forms["Form2"]
Copy linkTweet thisAlerts:
@_tim_authorSep 04.2008 — That works great, thanks Kor
×

Success!

Help @_tim_ spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...