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 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Aug 2002
    Location
    Orlando, Florida
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Macintosh Opening a new window w/ Link of the Day Script

    I would like the Link of the Day to open in a new window when using the Link of the Day Script. What do I need to do? Any and all assistance will be appreciated.

    <script language="">

    /*Day of the link script credit-
    By JavaScript Kit (www.javascriptkit.com)
    Over 200+ free scripts here!
    */
    var daylinks=new Array()
    /*
    Enter the 31 urls below you wish to go to for each day of the month. Note that if the current month contains less than 31 days, then some of the urls will simply not be used
    */
    daylinks[1]="http://www.designsbyrachelle.com"
    daylinks[2]="http://www.xchangeitnetwork.com"
    daylinks[3]="http://www.cnet.com"
    daylinks[4]="http://www.geocities.com"
    daylinks[5]="http://www.lycos.com"
    daylinks[6]="http://www.infoseek.com"
    daylinks[7]="http://www.hotbot.com"
    daylinks[8]="http://www.tripod.com"
    daylinks[9]="http://www.javascriptkit.com"
    daylinks[10]="http://www.wired.com"
    daylinks[11]="http://www.download.com"
    daylinks[12]="http://www.windows95.com"
    daylinks[13]="http://www.shareware.com"
    daylinks[14]="http://www.builder.com"
    daylinks[15]="http://www.htmlgoodies.com"
    daylinks[16]="http://www.webreference.com"
    daylinks[17]="http://www.webdeveloper.com"
    daylinks[18]="http://www.developer.com"
    daylinks[19]="http://www.news.com"
    daylinks[20]="http://www.techweb.com"
    daylinks[21]="http://www.zdnet.com"
    daylinks[22]="http://www.excite.com"
    daylinks[23]="http://www.nba.com"
    daylinks[24]="http://www.microsoft.com"
    daylinks[25]="http://www.blackgirlzapparel.com"
    daylinks[26]="http://www.amazon.com"
    daylinks[27]="http://www.xml.com"
    daylinks[28]="http://www.espn.com"
    daylinks[29]="http://www.nbc.com"
    daylinks[30]="http://www.cbs.com"
    daylinks[31]="http://www.hotwired.com"
    var mydate=new Date()
    var today=mydate.getDate()

    </script>
    <a href="today.htm" onClick="window.location=daylinks[today];return false">CLICK
    HERE and Visit Today's Site</a>

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    var rand = Math.floor(Math.random() * daylinks.length);
    (...)
    <a href="today.htm" onClick="window.location=daylinks[rand];return false">CLICK
    HERE and Visit Today's Site</a>

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    Atlanta, GA.
    Posts
    313
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Use this for the link and the link will open in a new window.
    Code:
    <a href="today.htm" onClick="this.href=daylinks[today];return true" target="_blank">CLICK 
    HERE and Visit Today's Site</a>
    The answer does not come from thinking outside the box, it comes from realizing the truth :-
    "There Is No Box". [JavaScript Gadgets'n'Gizmos][JavaScript-FX]

  • #4
    New to the CF scene
    Join Date
    Aug 2002
    Location
    Orlando, Florida
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you Roy, but I tried that and it doesn't work. Any other suggestions?

  • #5
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    My apologies. I answered the wrong question! Here is what you need
    Code:
    <a href="javascript:;" onClick="window.open(daylinks[today],'_blank','');">CLICK HERE and Visit Today's Site</a>
    or
    Code:
    <script>
    document.write('<a href="'+daylinks[today]+'" target="_blank">CLICK HERE and Visit Today's Site</a>');
    </script>

  • #6
    New to the CF scene
    Join Date
    Aug 2002
    Location
    Orlando, Florida
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks Beetle....this one worked!

    code:
    ------------------------------------------------------------------------
    <a href="java script:;" onClick="window.open(daylinks[today],'_blank','');">CLICK HERE and Visit Today's Site</a>
    ------------------------------------------------------------------------

    Another question...if I would like to add a class id to the script, where would I add it?

  • #7
    Regular Coder Skyzyx's Avatar
    Join Date
    Aug 2002
    Location
    Silicon Valley, CA
    Posts
    980
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If you're talking about a CSS Class, it would be:
    Code:
    <a href="javascript:;" onClick="window.open(daylinks[today],'_blank','');" class="whatever">CLICK HERE and Visit Today's Site</a>
    If you're talking about adding an ID, it would be:
    Code:
    <a href="javascript:;" onClick="window.open(daylinks[today],'_blank','');" id="whatever">CLICK HERE and Visit Today's Site</a>

    Creator of SimplePie and Tarzan AWS, co-founder of WarpShare, co-built the Y! Messenger website, usability-focused, and an INFJ personality.


  •  

    Posting Permissions

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