471,596 Members | 810 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,596 software developers and data experts.

parent/iframe set iframe source and submit form

Ok, I've been at this two days now and have scoured the group for help
to no avail.

I have a main web page that contains a form and an iframe. I need to
submit the form and set the iframe source file in one action and have
it work with both IE and other browsers. So far, i have not had any

Form name "fmUpload", frame name, "progframe".

At one point i tried doing both in one function on the main page:
function startupload() {
var iframe = document.getElementById("progframe");
iframe.src = "http://newurl.com/iframe.html";

Did not work in both IE and FF.

Then i tried doing the set iframe src on the form button click, then
the new iframe page submit the parent form using a body onLoad. That
did not work in IE with:

function subForm() {
<body onLoad=subForm()>

This really hurts. If anyone can help me with a simple explanation, i
would appreciate it. Code would be much appreciated!

Mar 9 '06 #1
2 16913
The thing that catches my eye here is where you say that you have "Form
name "fmUpload", frame name, "progframe"". If the <iframe> is written
<iframe name="progframe">...</iframe>
then in the JavaScript, the line,
var iframe = document.getElementById("progframe");
will not work. The proper HTML would have to be:
<iframe id="progframe">...</iframe>

should work too and may be a bit more clear.

Other than that, the js function looks OK and should work in both IE
and FF

If this doesn't help, let me know.

Mar 9 '06 #2
Thanks for the reply. I managed to get it running in both IE and FF.
The order the code was executed in happend to make a difference for
some reason. Doing the frame location before th form submit changed teh
frame location without the action

here is my final code:
<SCRIPT Language="JavaScript">
function startupload() {
frames['progframe'].location.href = "http://yyy.com/yyy";
The form button triggers an onClick even calling the script.

hope that helps anyone else that may have had issues.

Mar 9 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by HolaGoogle | last post: by
1 post views Thread by XP | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.