PDA

View Full Version : selection box



cadaver
11-23-2005, 08:07 PM
<script language="JavaScript">
function changer (URLNavigation) {
if (URLNavigation != "") {
self.location.href = URLNavigation;
}
}
</script>
<select NAME="navigo" onChange="changer(this.options[this.selectedIndex].value)">
<option value="a.htm">page a
<option value="b.htm">page b
</select>

in this code shown above you can select "page a" or "page b" as options and you wil be redirected to "a.htm" or "b.htm" when you select them.

in the javascript code red highlighted area makes the selection will be shown in the same frame. if i change it to "top.location.href" the selection will be shown in the "_top" frame

here is my problem:
think that i have framed page. frames' names are "left" and "main" respectively.
how can i make a selection opens a page in a frame named "main"

Twey
11-23-2005, 08:31 PM
Use parent.frames['main'] instead of window (or self, as you've used it here).

<script type="text/javascript">
function changer (URLNavigation) {
if (URLNavigation != "") parent.frames['main'].location.href = URLNavigation;
}
</script>
<select name="navigo" onchange="changer(this.options[this.selectedIndex].value)">
<option value="a.htm">page a</option>
<option value="b.htm">page b</option>
</select>

cadaver
11-23-2005, 09:41 PM
yeah it's what i exactly need. thanks