SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Guru
    Join Date
    Mar 2001
    Location
    Highlands Ranch, Colorado
    Posts
    614
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello,
    I am having problems with DHTML. I am trying to target a link to open a new browser window when the user selects this link. It works fine in normal HTML but if I try to do this on a link in DHTML - it fails. It loads a URL just fine but not in a new browser window.

    What am I doing wrong?

  2. #2
    Irritability Defined
    Join Date
    Jul 2000
    Location
    80,000 feet below the surface
    Posts
    1,442
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you give us the appropriate snippets of code we might be able to help pinpoint your problem
    My 2 Cents (or is that 2.2 Cents including GST?)

  3. #3
    SitePoint Guru
    Join Date
    Mar 2001
    Location
    Highlands Ranch, Colorado
    Posts
    614
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is what I am trying to open in a new browser window or in the same parent window. "Home" is the displayed text for my users.

    dhtmlMenu.addItem(new NavBarMenuItem("Home", "http://www.myURL.com"));

    This is how I did it in HTML:

    <a href="http://www.myURL.com" target="_blank">

    Sorry for not being detailed enough!

    Thanks!

  4. #4
    SitePoint Guru
    Join Date
    Mar 2001
    Location
    Highlands Ranch, Colorado
    Posts
    614
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, found some more stuff but do now know how to put it into my code:

    javascriptarent.framename.location='http://www.myURL.com'

    framename = target

    How would I need to put that piece of code into the line I posted earlier?

  5. #5
    Irritability Defined
    Join Date
    Jul 2000
    Location
    80,000 feet below the surface
    Posts
    1,442
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Let me guess... This is one of Mike Hall's wonderful DHTML menus, right? ;) And that it came from
    http://www.dynamicdrive.com/dynamicindex1/topnavbar.htm

    Try modifying the JavaScript string to

    javascript:parent.blank.location='http://dynamicdrive.com'

    and see if it works.
    My 2 Cents (or is that 2.2 Cents including GST?)

  6. #6
    SitePoint Guru
    Join Date
    Mar 2001
    Location
    Highlands Ranch, Colorado
    Posts
    614
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You are right. I am experimenting with his menu code.

    I used the javascript part but do not get it to work. I guess I am placing it wrong within the code.

    dhtmlMenu.addItem(new NavBarMenuItem("Home", "javascriptarent.blank.location='http://www.myURL.com'"));

    I also tried it without the "

    Sorry for not being specific enough the first time - has been a rough day. :-)

  7. #7
    SitePoint Guru
    Join Date
    Mar 2001
    Location
    Highlands Ranch, Colorado
    Posts
    614
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Got it to work!!

    To open link in parent window:
    dhtmlMenu.addItem(new NavBarMenuItem("Home", "javascript:window.top.location='http://www.myURL.com'"));

    To open link in new window:
    dhtmlMenu.addItem(new NavBarMenuItem("www.puetz-colorado.com", "javascript:window.open('http://www.myURL.com')"));
    Last edited by Christoph; Mar 25, 2001 at 16:42.


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
  •