Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q913 How can I pass the value of a selected option of a drop-down box from one frame to a text field in another frame without having to press any buttons?

irt.org | Knowledge Base | JavaScript | Form 4 | Q913 [ previous next ]

Q913 How can I pass the value of a selected option of a drop-down box from one frame to a text field in another frame without having to press any buttons?

First the frameset:

<frameset rows="50%,*">
<frame src="page1.htm" name="frameNameA">
<frame src="page2.htm" name="frameNameB">
</frameset>

Then in page1.htm:

<form name="myFormName">
<input type="text" name="myFieldName">
</form>

Then in page2.htm:

<form>
<select onChange="parent.frameNameA.document.myFormName.myFieldName.value = this.options[this.selectedIndex].value">
<option value="hello world">option 0
<option value="Hello world">option 1
<option value="Hello World">option 2
<option value="hELLO wORLD">option 3
<option value="HELLO WORLD">option 4
</select>
</form>

To get this to work for a form field on the same page use:

<form name="myFormName">
<input type="text" name="myFieldName">
<br>
<select onChange="document.myFormName.myFieldName.value = this.options[this.selectedIndex].value">
<option value="hello world">option 0
<option value="Hello world">option 1
<option value="Hello World">option 2
<option value="hELLO wORLD">option 3
<option value="HELLO WORLD">option 4
</select>
</form>

Feedback on 'Q913 How can I pass the value of a selected option of a drop-down box from one frame to a text field in another frame without having to press any buttons?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.