...

View Full Version : Post to an iFrame



simora
07-31-2010, 10:40 PM
Hi:

How can I extend this so that it posts the data from these 2 fields to an iframe,
and what code do I need in the iframe to capture the data and present it in 2 fields?

On the sending page, I have


<script type="text/javascript">
function passValue() {
var ddl = document.getElementById("ddlName");
var index = ddl.selectedIndex;
document.getElementById("txtValue").value = ddl.value;
document.getElementById("txtName").value = ddl.options[index].text;
}
</script>



<iframe ID="first_iframe" src="http://xxx.net/iPage.html" width="600" height="400">
</iframe>

sample code appreciated. Thanks

semiSkim
07-31-2010, 11:15 PM
<form target="first_iframe" action=""http://xxx.net/iPage.html">
//your inputs here
</form>




<iframe ID="first_iframe" width="600" height="400">
</iframe>

simora
08-01-2010, 01:27 AM
Thanks for your effort;
The form is not being submitted by a submit button. The function is the result of a SELECT as part of a Listbox.

What I'm looking for is the correct code to extend the function to include the post to the iframe.

simora
08-01-2010, 02:30 AM
Got it to work using

document.getElementById("iframe").contentDocument.getElementById("txtValue").value = ddl.value;

Problem with Firefox. Somehow, it wouldn't work there.

Thanks anyway..

semiSkim
08-01-2010, 01:20 PM
well to submit a form with JavaScript you have to use:



document.forms['form1'].submit();

simora
08-01-2010, 10:34 PM
semiSkim :

You are correct. Its my vocabulary.
I'm just selecting a value and passing it to input boxes and the iframe. I'm not actually submitting the values somewhere else.

You were a great help. Thanks



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum