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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2003
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Help with Targeting within free menu script.

    I am using a free menu script and am a little stuck in trying to get the links to open in a new window.

    The segment that (I believe) handles the links is as follows:

    var menui = new Array();
    var menul = new Array();

    //configure below for menu items. Extend list as desired

    menui[0]="Title1";
    menui[1]="Title2";
    menui[2]="Title3";
    menui[3]="title4";
    menui[4]="Title5";
    menui[5]="Title6";

    menul[0]="http://link1";
    menul[1]="http://link2";
    menul[2]="http://link3";
    menul[3]="http://link4";
    menul[4]="http://link5";
    menul[5]="Http://link6";

    for (i=0;i<=menui.length-1;i++)
    if (ie4||ns6) {document.write('<TR><TD BORDERCOLOR="white" ONCLICK="location=\''+menul[i]+'\'" onmouseover="className=\'menuh\'" onMouseout="className=\'menu\'"><CENTER><FONT SIZE=2 FACE=Verdana COLOR=#000066>'+menui[i]+'</FONT></TD></TR>')}
    else if (ns4){document.write('<TR><TD BGCOLOR="white"><ILAYER><LAYER width="'+menuwidth+'" onmouseover="bgColor=\'yellow\'" onmouseout="bgColor=\'white\'"><CENTER><A HREF="'+menul[i]+'" class=menulinks>'+menui[i]+'</A></CENTER></LAYER></ILAYER></TD></TR>')}


    All I want to do is have each item open in either the same window (default) OR in a new window (and to specify each to include window siezes etc would be nice too!)

    Any help would be much appreciated.

    Thanks

    Roy.

  • #2
    Regular Coder
    Join Date
    Jan 2003
    Posts
    867
    Thanks
    4
    Thanked 8 Times in 8 Posts
    Change the onclick from location to window.open

    change this:
    ONCLICK="location=''+menul[i]+''"

    to either of these:
    ONCLICK="window.open('+menul[i]+', '_blank')"

    ONCLICK="window.open('+menul[i]+', '_self')"

    No guarantees on my quotation marks or apostrophes


  •  

    Posting Permissions

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