Results 1 to 3 of 3

Thread: selection box

  1. #1
    Join Date
    Nov 2005
    Location
    ankara / turkiye
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default selection box

    <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"
    Last edited by cadaver; 11-23-2005 at 08:08 PM. Reason: correcting the code

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Use parent.frames['main'] instead of window (or self, as you've used it here).
    Code:
    <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>
    Last edited by Twey; 11-23-2005 at 08:36 PM.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Nov 2005
    Location
    ankara / turkiye
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    yeah it's what i exactly need. thanks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •