Creating a combo menu that loads the target URL in another frame

You've been pounding your head over the keyboard trying to get a combo box to load the selected URL in another frame. Well, its actually very simple, and to accomplish such a task, there are simply two things that needs to be done:

1) Give each frame a name by using the name attribute inside the <frame src='..'> tags
2) Use the frame's name in place of  "location" in function go() of our original combo code.

Lets take this one step at a time.

First, give each frame a name. We're use the below simple frames page as an example:

<frameset cols="30%,70%">
<frame src="page1.htm" name="Peter">
<frame src="page2.htm" name="Jane">

The name attributes inside each FRAME is needed to tell JavaScript which frame we want the combo box to load the specified URL in.

Now, having done that,  the remaining job is simply to modify our combo code so it targets the desired frame. Assuming the combo code is in page1.htm, and we want it to load the URL into page2.htm. Here's how:

<script type="text/javascript">
function go(){

Notice the keyword "parent". This object represents the parent window in a frames page, and is required as a prefix, since we need to "walk up" one level in order to reach page2.htm, a document parallel in level ti page1.htm. Following "parent" is "Jane", the frame name of page2.htm.

That's all there is to it. Lets see an example of such a combo box:

Click here to see example.