SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2000
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    need help from javascript master

    I have the following code which loads a target URL into the current window --

    <form name="weeklyoptionsform">
    <select name="weeklyoptions" size="1" onchange="goMonthlyOptions();">
    <option selected>Choose...
    <option value="ahuntsiccartiervilledirect/weekly/index.html">Ahuntsic Cartierville Direct
    <option value="aireporter/weekly/index.html">A. I. Reporter
    </select>
    </form>

    And the function being called is --

    function goMonthlyOptions(){
    if (document.monthlyoptionsform.monthlyoptions.options[document.monthlyoptionsform.monthlyoptions.selectedIndex].value!=''){ document.location.href=document.monthlyoptionsform.monthlyoptions.options[document.monthlyoptionsform.monthlyoptions.selectedIndex].value
    }
    }

    My problem is this;
    If I put the above into a frame named "header" and I want the resulting target URL to appear in a frame named "stats", how can I do it? I've tried, oh my how I've tried, but I'm just overlooking something and now just blanking out. Thanks all for any help.
    marty_p

    MENZ.com site administrator.

  2. #2
    SitePoint Guru
    Join Date
    Sep 1999
    Location
    Singapore
    Posts
    854
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Instead of

    Code:
    document.location.href
    Try
    Code:
    parent.stats.location.href
    Its been a long time since I've worked with frames though, so I'm not entirely sure.

  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2000
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    that's confusing

    Duckie, you got it perfectly in one shot but that's terribly confusing. I had tried using

    top.stats.location.href

    and it was a bust. Why would "parent.stats.location.href" work instead?

    BTW, thanks MUCH.
    marty_p

    MENZ.com site administrator.

  4. #4
    SitePoint Guru
    Join Date
    Sep 1999
    Location
    Singapore
    Posts
    854
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Odd "top" did not work for you.

    "parent" and "top" are synonyms in certain circumstances. Specifically, "parent" refers to the frameset which contains the page you are in and "top" refers to the top most frameset.

    Anyway, glad I was able to help.

  5. #5
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    top opens the requested page over everything (ie: outside of the frameset). Parent goes "up" one level to the "parent" document (which is the frameset) then "down" into the specified frame (stats).
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes


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
  •