Jump to Real's How-to Main page

Send the FORM response to another FRAME

To send the result of a FORM request to another FRAME, you provide the FRAME name in the target property of the FORM. The FRAME name is the one defined by the NAME parameter in the FRAME declaration. The name must be unique.

[main HTML (a.html)]

<HTML><HEAD></HEAD>
<FRAMESET COLS="50%,*">
    <FRAME SRC="f1.html" NAME="f1" >
    <FRAME SRC="f2.html" NAME="f2">
</FRAMESET>
</HEAD>

[f1.html]

<HTML><HEAD></HEAD><BODY>
<FORM NAME="tFORM"
    METHOD=GET
     ACTION="http://www.abc.com/theCGI"
     onSubmit="document.tFORM.target = 'f2';return true;"
     >
<INPUT TYPE=HIDDEN NAME="n" VALUE="Real Gagnon">
<INPUT TYPE=SUBMIT VALUE="Output to f2 frame">
</FORM></BODY>
</HEAD>
>

Thanks to Amos Bieler for the following tip

Rather than use "document.tFORM.target" you could simply put the "TARGET" attribute in the FORM tag in the first place.


If you find this article useful, consider making a small donation
to show your supportfor this Web site and its content.

Written and compiled by Réal Gagnon ©1998-2005
[ home ]