submitting a form within an Iframe

T

taltal78

Hello,

I have a form inside an iFrame which I want to submit with javascript
as the iframe loads.
For example:

<iframe src="" name="myiframe" id="myiframe>
<form method="post" id="myform" name="myform" action="http://
www.yahoo.com" target="_self">
</form>
</iframe>

No matter how I try to submit the form I cannot get it.
I'm getting null on:
- document.getElementsByName("myform") ,
- document.myiframe.myform
all other combinatinos I try gives the same, i cannot access the form.

Can you please assist me getting this working ?


Thanks!
Tal.
 
J

Jeff

Hello,

I have a form inside an iFrame which I want to submit with javascript
as the iframe loads.
For example:

<iframe src="" name="myiframe" id="myiframe>
<form method="post" id="myform" name="myform" action="http://www.yahoo.com" target="_self">
</form>
</iframe>

No matter how I try to submit the form I cannot get it.
I'm getting null on:
- document.getElementsByName("myform") ,
- document.myiframe.myform
all other combinatinos I try gives the same, i cannot access the form.

Can you please assist me getting this working ?

Thanks!
Tal.

It looks like your problem is getting a reference to the iframe, not
the submitting.

It turns out that getting that reference can be quite tricky.

There's a good article about it here:
http://www.quirksmode.org/js/iframe.html

-Jeff
 
T

TheBagbournes

You can't put content into an iframe inline, they don't work like that. They are little individual browser windows. They have an src attribute which you set to draw their content from a URL.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top