Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    New to the CF scene
    Join Date
    Sep 2003
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    HV Menu-can I link to new window?

    I'm about to use HV Menu...it looks really great...but I need to have some links open up in a new window (html would add target="_blank")

    In the config file it has the following on links:
    Link
    Text string- Where you want to go when you click the element.
    Looks like "MyLink"
    Can also be used to execute javascript statements. For instance when you want the link to open in the top window use "javascript:top.document.location.href='Link.htm';"
    You can in fact start a whole script when the element is clicked with the help of javascript:. "javascript:{your script; another function;}"

    so is there a javascript statement for a new window or blank window like ther is one for top window?

    Thanks!

  • #2
    Senior Coder
    Join Date
    Mar 2003
    Location
    OHIO
    Posts
    1,438
    Thanks
    1
    Thanked 0 Times in 0 Posts
    You answered your own question. Just use target blank in the links.

    MNS
    [size=1]"If you want to be "in the biz" you are going to have to roll with the changes or get out, basically."

  • #3
    New to the CF scene
    Join Date
    Sep 2003
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I tried it a number of ways....none have worked.

    "http://www.link.com target='_blank'"

    javascript:top.location.href='link.htm'
    javascript:new.location.href='link.htm'
    javascript:blank.location.href='link.htm'

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Posts
    626
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I believe the correct format would be:
    <a href="http://www.somesite.com" target="_new">Click Me</a>

    You can also use "_blank"

  • #5
    Senior Coder
    Join Date
    Mar 2003
    Location
    OHIO
    Posts
    1,438
    Thanks
    1
    Thanked 0 Times in 0 Posts
    It looks like this:

    <a href="http://www.yourlink.com" target="_blank">Link Text</a>

    To get it right, post the syntax of the links as they appear in the script.

    MNS
    [size=1]"If you want to be "in the biz" you are going to have to roll with the changes or get out, basically."

  • #6
    New to the CF scene
    Join Date
    Sep 2003
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for your replies...
    TUnfortunately those are conventional html code, which I understand...in this case, however, we are inside a javascript that generates hierarchical menus. I have clipped a portion of the script below that shows 5 sets of 2 & 3 tiered menus...At the top it comments out the structure. The "Link" just appears within quotes with a string of other attributes.

    What I'm looking for is the equivalent javascript comment to"javascript:top.document.location.href='Link.htm';" or "javascript:top.href='Link.htm';"which makes the link load in the top window to make it load in a new window. (You can see this javascript comment in MenuArray5 at the bottom.)

    Here is the Menu syntax script snippet:

    // Menu tree
    // MenuX=new Array(Text to show, Link, background image (optional), number of sub elements, height, width);
    // For rollover images set "Text to show" to: "rollover:Image1.jpg:Image2.jpg"

    Menu1=new Array("Home","http://www.dynamicdrive.com","",0,20,138);

    Menu2=new Array("News","blank.htm","",2);
    Menu2_1=new Array("General","blank.htm","",5,20,150);
    Menu2_1_1=new Array("CNN","http://www.cnn.com","",0,20,150);
    Menu2_1_2=new Array("ABCNews","http://www.abcnews.com","",0);
    Menu2_1_3=new Array("MSNBC","http://www.msnbc.com","",0);
    Menu2_1_4=new Array("CBSNews","http://www.cbsnews.com","",0);
    Menu2_1_5=new Array("Canadian News","http://news.bbc.co.uk","",2);
    Menu2_1_5_1=new Array("Vancouver Sun","http://www.vancouversun.com","",0,20,150);
    Menu2_1_5_2=new Array("CTV News","http://www.ctvnews.com","",0);
    Menu2_2=new Array("Technology","blank.htm","",3);
    Menu2_2_1=new Array("TechWeb","http://www.techweb.com","",0,20,200);
    Menu2_2_2=new Array("News.com","http://www.news.com","",0);
    Menu2_2_3=new Array("Wired News","http://www.wired.com","",0);

    Menu3=new Array("Search Engines","blank.htm","",3);
    Menu3_1=new Array("Altavista","http://www.altavista.com","",0,20,150);
    Menu3_2=new Array("Google","http://www.google.com","",0);
    Menu3_3=new Array("Yahoo","http://www.yahoo.com","",0);

    Menu4=new Array("Webmaster","blank.htm","",4);
    Menu4_1=new Array("Dynamic Drive","http://www.dynamicdrive.com","",0,20,180);
    Menu4_2=new Array("JavaScript Kit","http://www.javascriptkit.com","",0);
    Menu4_3=new Array("Freewarejava","http://www.freewarejava.com","",0);
    Menu4_4=new Array("Web Review","http://www.webreview.com","",0);

    Menu5=new Array("Other","javascript:top.location.href='blank.htm'","",1);
    Menu5_1=new Array("Author\'s Site","http://www.burmees.nl/","",0,20,140);

  • #7
    Senior Coder
    Join Date
    Mar 2003
    Location
    OHIO
    Posts
    1,438
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Menu2_1_1=new Array("CNN","http://www.cnn.com" onclick="NewWindow(this. href,\'BLANK\');return false","",0,20,150);

    I "think" that may work.

    MNS
    [size=1]"If you want to be "in the biz" you are going to have to roll with the changes or get out, basically."

  • #8
    New to the CF scene
    Join Date
    Sep 2003
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Angry

    thanks for trying...but it didn't work.

    I also tried it removing the space between this. href

    -D

  • #9
    Regular Coder
    Join Date
    Aug 2003
    Posts
    383
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Might as well do this systematically. Add this to any of the scripts:
    Code:
    var putItThere = null; 
    var chasm = screen.availWidth;
    var mount = screen.availHeight;
    var wd = chasm*.9;     // percentage of screen width occupied by pop-up
    var ht = mount*.8;      // percentage of screen height occupied by pop-up
    
    function deadCenter(url) {
         putItThere = window. open(url,'putItThere','width='+wd+',height='+ht+',left='+((chasm-wd-10)*.5)+',top='+((mount-ht-25)*.5)+',scrollbars,status,titlebar');
         if (putItThere & !putItThere.closed)     
             putItThere.focus();
    }
    Get rid of the spaces after 'window' and the line feed later on (this board sucks).

    Then:

    Menu2_1_1=new Array("CNN","javascript&#58;void deadCenter('http://www.cnn.com')","",0,20,150);

    More:
    http://www.codingforums.com/showthre...threadid=26065
    &nbsp;........ another wild guess ........

  • #10
    New to the CF scene
    Join Date
    Sep 2003
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool

    Yippee!

    I don't care what everybody else says about you, you're no cheesebag, you're a hero!

    thanks so much!

  • #11
    Ger
    Ger is offline
    New Coder
    Join Date
    Aug 2002
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Or, a bit more simple:

    "javascript:NewWin=window.open('http://www.cnn.com','NWin');window['NewWin'].focus()"


  •  

    Posting Permissions

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