SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast Crockett's Avatar
    Join Date
    Jan 2002
    Location
    Miami FLA
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    window.open to named anchor within frameset

    Hi all-

    I'm opening a new window that contains a simple frameset (topFrame,mainFrame). On the mainFrame page I have along list of service descriptions each with their own named anchor.

    Here is the script i'm using to open / center window in browser (script is from 'ultimate window pack' extention for dreamweaver):

    <!--
    function displayWindow(theURL,winName,width,height,features) { //v3.1
    // Made by Eddie Traversa modified from Macromedia Code
    // http://nirvana.media3.net/
    var window_width = width;
    var window_height = height;
    var newfeatures= features;
    var window_top = (screen.height-window_height)/2;
    var window_left = (screen.width-window_width)/2;
    newWindow=window.open(''+ theURL + '',''+ winName + '','width=' + window_width + ',height=' + window_height + ',top=' + window_top + ',left=' + window_left + ',features=' + newfeatures + '');
    newWindow.focus();
    }
    //-->

    Any suggestions on how I could modify this script so that I can somehow tell my mainFrame page to go directly to a named anchor ?

  2. #2
    SitePoint Enthusiast
    Join Date
    Mar 2002
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    After a proper time out to wait for the frame set to load, redirect the mainFrame to the anchor point.
    Code:
    // Modify displayWindow() to return the new window
    function displayWindow() {
    ....
    return newWindow ;
    }
    // Then
    var newWindow = displayWindow(bla bla) ;
    // After 2 seconds, redirec to the anchor
    setTimeout("newWindow.mainFrame.location.href = 'UrlOfTheMainFrame#NamedAnchor'", 2000) ;

  3. #3
    SitePoint Enthusiast Crockett's Avatar
    Join Date
    Jan 2002
    Location
    Miami FLA
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thanks!!

    thanx - works like a charm...

  4. #4

  5. #5
    SitePoint Member
    Join Date
    Dec 2004
    Location
    earth
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Sooo close...

    Thanks for the insight on setTimer! It does work like a charm if there is only one namedAnchor I need to bounce to.

    My next question is how do I augment this script so that I can pass a unique namedAnchor to the script so that once the window is popped, it will go to the unique namedAnchor from the hyperlink which calls the popped window? Can such a task be accomplished?

    I know it's been a while since this script was posted, but I would appreciate your insight on this.

    All the best!
    MM


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
  •