Forum Moderators: open

Message Too Old, No Replies

Controlling iframe target location with javascript for a form

iframe form controll with javascript

         

advancedgraphix

6:03 am on Jul 27, 2008 (gmt 0)

10+ Year Member



Hi, I'm working on placing a MLS home search within an iframe on my page, I don't want the form to jump to a _blank page when submited, instead I want the results to show up in my iframe.

I don't have access to the form to change its target location, I have seen several examples how to do it with javascript..

I'm thinking something along the lines of:
document.getElementById('testiframe').src = 'newpage.html';
frames['testiframe'].location.href = 'newpage.html';

This is what the form looks like, which I can't change:
<FORM METHOD="POST" NAME="form1" ACTION="mlsq2r.cfm?startat=1" TARGET="_top">

I would appreciate any help :)

tedster

9:49 am on Jul 27, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you can't access the source code for the url that you put in the iframe, then you cannot override that code's target attribute. Unfortunately for your hopes, that's the way it is.