Results 1 to 2 of 2

Thread: Static Menu Script- Open links in new window?

  1. #1
    Join Date
    Mar 2005
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Static Menu Script- Open links in new window?

    Script:
    http://www.dynamicdrive.com/dynamici...cmenu3_dev.htm

    Hello everyone,
    I'm very new at learning JavaScript, but I have tried everything to get the links in the static menu script above to open in a new window? I have tried to do the <a href="url of link" target="_blank">TEXT</a> thing for the URL, but the whole menu disappeared. LOL


    Can some one pleeeease help me


    Thank you!

    Here's the code if it helps. I know it's a simple fix, but I don't know what I'm doing. LOL

    Code:
    <SCRIPT Language="Javascript1.2">
    <!--
    
    /*
    Static menu script (By maXimus, maximus@nsimail.com, http://absolutegb.com/maximus/)
    Modified slightly/ permission granted to Dynamic Drive to feature script in archive
    For full source, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
    */
    
    //configure below variable for menu width, position on page
    var menuwidth=110
    var offsetleft=10
    var offsettop=90
    
    var ns4=document.layers?1:0
    var ie4=document.all?1:0
    var ns6=document.getElementById&&!document.all?1:0
    
    function makeStatic() {
    if (ie4) {object1.style.pixelTop=document.body.scrollTop+offsettop}
    else if (ns6) {document.getElementById("object1").style.top=window.pageYOffset+offsettop}
    else if (ns4) {eval(document.object1.top=eval(window.pageYOffset+offsettop));}
    setTimeout("makeStatic()",0);
    }
    
    if (ie4||ns6) {document.write('<span ALIGN="CENTER" ID="object1" STYLE="Position:absolute; Top:20; Left:'+offsetleft+'; Z-Index:5;cursor:hand;background-color:black;"><TABLE BORDER="1" width="'+menuwidth+'" CELLPADDING="0" CELLSPACING="0" BORDERCOLOR="black" bgcolor="white">')}
    else if (ns4){ document.write('<LAYER top="20" name="object1" left="'+offsetleft+'" BGCOLOR=black><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="1"><TR><TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" width="'+menuwidth+'">')}
    
    if (ie4||ns6||ns4)
    document.write('<TR><TD BGCOLOR="#3399FF" BORDERCOLORDARK="#99CCFF" BORDERCOLORLIGHT="#003399"><P ALIGN=CENTER><FONT SIZE="4" FACE=ARIAL>Menu</FONT></TD></TR>')
    
    var menui = new Array();
    var menul = new Array();
    
    //configure below for menu items. Extend list as desired
    
    menui[0]="Dynamic Drive";
    menui[1]="What\'s New?";
    menui[2]="What\'s Hot?";
    menui[3]="Message Forum";
    menui[4]="FAQs";
    menui[5]="Submit Script";
    menui[6]="Link to us";
    menui[7]="Email us";
    
    menul[0]="http://dynamicdrive.com";
    menul[1]="http://dynamicdrive.com/new.htm";
    menul[2]="http://dynamicdrive.com/hot.htm";
    menul[3]="http://wsabstract.com/cgi-bin/Ultimate.cgi";
    menul[4]="http://dynamicdrive.com/faqs.htm";
    menul[5]="http://dynamicdrive.com/submit.htm";
    menul[6]="http://dynamicdrive.com/link.htm";
    menul[7]="http://dynamicdrive.com/contact.htm";
    
    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>'+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>')}
    
    if (ie4||ns6) {document.write('</TABLE></span>')}
    else if (ns4){document.write('</TABLE></TD></TR></TABLE></LAYER>')}
    
    function menu3(){
    if (ns6||ie4||ns4)
    makeStatic()
    }
    
    window.onload=menu3
    
    //-->
    </SCRIPT>

    I know it has to be in this part of the script somewhere:
    Code:
    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>'+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>')}
    
    if (ie4||ns6) {document.write('</TABLE></span>')}
    else if (ns4){document.write('</TABLE></TD></TR></TABLE></LAYER>')}
    Last edited by Naild; 03-14-2005 at 03:08 AM.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default Answer at other post

    I answered this question at your other post:

    http://www.dynamicdrive.com/forums/s...ead.php?t=2064

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
  •