SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2002
    Location
    Birmingham UK
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question forcing links to _top with javascript

    My page has got two frames, one at the top for a menu and one for content. I want some links in the topframe to be targetted to the "_top" of the browser window with Javascript.

    What is the syntax for this?

    Thanks,

  2. #2
    <C²: web standards /> cybercodeur's Avatar
    Join Date
    Dec 2001
    Location
    Montréal
    Posts
    729
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    When you say targetteed to the _top, do you actually mean another new browser window or the top frame of your frameset?

    If you mean overwriting the window (replacing what's inside it), then it's simply target="_top" and if you mean the top frame of your frameset, then its target="nameofthetopframe".

    Somehow, I feel this is not what you mean though. This has nothing to do with javascript, it's purely html.

    If I'm offtrack, please be more specific.
    Last edited by cybercodeur; Mar 5, 2002 at 11:50.
    Denis Boudreau <C²/> - Web Standards & Accessibility
    [+] ICQ number: 115649885 || Email: denis@cybercodeur.net
    [+] Daily Weblog on Web standards and accessibility : CYBERcodeur.net

  3. #3
    SitePoint Addict
    Join Date
    Mar 2001
    Location
    the windy city
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <a href="file.htm" target="_top">target "_top"</a>
    this will cause the documen to load at the top-level window, i.e. a linked document with target="_top" 'busts out" of teh frame set and is displayed directly in the browser window.
    Goals are dreams with deadlines
    -------------------------------------
    Nimlok Trade Show Displays Booths and Exhibits

  4. #4
    SitePoint Enthusiast
    Join Date
    Feb 2002
    Location
    Birmingham UK
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    top of the browser window

    I want the links to load pages over all of the current frames (as HTML 'TARGET="_TOP"' does it).

    But I can't use HTML as I am using an ASP component that creates menu's and the only way it links through is with Javascript location.href.

    Thats why I'm restricted to Javascript.

    Just to be more detailed, I have a menu in the top frame. Content in the bottom frame. Some of the links need to jump out of the frameset and take over the whole browser window and these need to be done with Javascript links.

    Hope this is easier to understand now...

  5. #5
    <C²: web standards /> cybercodeur's Avatar
    Join Date
    Dec 2001
    Location
    Montréal
    Posts
    729
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I believe it would simply be parent.window.top or window.top but I wouldn't bet too much on it...
    Denis Boudreau <C²/> - Web Standards & Accessibility
    [+] ICQ number: 115649885 || Email: denis@cybercodeur.net
    [+] Daily Weblog on Web standards and accessibility : CYBERcodeur.net

  6. #6
    <C²: web standards /> cybercodeur's Avatar
    Join Date
    Dec 2001
    Location
    Montréal
    Posts
    729
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    okay I tested this and it works. Forget what I told you earlier, this is it.

    onclick="top.location.href='yourpage.asp';"

    That's it!
    Denis Boudreau <C²/> - Web Standards & Accessibility
    [+] ICQ number: 115649885 || Email: denis@cybercodeur.net
    [+] Daily Weblog on Web standards and accessibility : CYBERcodeur.net


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
  •