Send selected values to an iFrame

I have a listbox that populates 2 fields.

How can I get the output from this form to be sent to an iFrame.
I’m trying to see how to set these input fields into variables.

Here’s a bit of what I have.


<script type="text/jscript">
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>

<P>
Course Name <input type=“text” id=“txtName” readonly=“readonly”/><BR>

Course ID :<input type=“text” id=“txtValue” readonly=“readonly”/><br>
<P>

I load values from a database into a ListBox. Then make a selection.

<select size= 5 id=“ddlName” onchange=“passValue()”>

The selected values are correctly placed into the input fields.
I’m trying to get the 2 values “txtName” and “txtValue” sent to the iframe also.

<iframe src=“http://xxx.net/iPage.html” width=“600” height=“400”> </iframe>

The iFrame has 2 input fields of the same names.

Thanks

HI:

The code works in IE and Opera. The problem was in Firefox.

I needed to add an ID to the iFrame, and make the input on the iFrame like
<input id=“txtValue” type=“text”>

Thanks for your help.

// first iframe in document
frames[0].document.getElementById('txtValue').value = ddl.value;
// iframe with ID
document.getElementById([I]iframeID[/I]).contentDocument.getElementById('txtValue').value = ddl.value'

Thanks dogFang:

I didn’t get it to work. All I was thinking of was a way to possibly modify the function so that it posted the results to the iFrame also, and a way to have the iFrame access the var data.


[SIZE="1"]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;
}
[/SIZE]

Thanks