Hi
I have a simple iframe inside a table. This iframe includes a php form, that after sending it, should print a simple message outside the iframe (in the page, I don't care where..)
Can JavaScript help me to print it outside the iframe?
Hi
I have a simple iframe inside a table. This iframe includes a php form, that after sending it, should print a simple message outside the iframe (in the page, I don't care where..)
Can JavaScript help me to print it outside the iframe?
Don't you mean when submitting the form? And you don't really mean print, except from the programming point of view, right? If I've got that right - say this is the beginning of your form in your iframe:
And on your top page you have:Code:<form action="whatever" method="whatever" onsubmit="top.document.getElementById('form_response').firstChild.nodeValue = 'Some simple message';return true;">
it should all work out.Code:<div id="form_response"> </div>
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
I just tested this out to be sure and it works fine, except in FF if you refresh the top page and submit again there is an error. This can be avoided by a short script on the top page that refreshes the iframe to its original source on reload of the top page. Here are my two pages, added code highlighted -
top page:
form.htm:Code:<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><script type="text/javascript"> window.onload = function(){ document.getElementById('form_frame').src = 'form.htm'; } </script></head> <body> <iframe id="form_frame" src="form.htm" width="300" height="300" scrolling="auto" frameborder="1"></iframe> <div id="form_response"> </div> </body> </html>
Code:<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <form action="#" onsubmit="top.document.getElementById('form_response').firstChild.nodeValue = 'Some simple message';return true;"> <input type="submit" value="Go"> </form> </body> </html>
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
d-machine (07-17-2008)
Thank you very much !!!!!
Bookmarks