...

View Full Version : Opening a new window w/ Link of the Day Script



robchelle2
08-26-2002, 07:13 PM
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>

beetle
08-26-2002, 07:23 PM
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>

RoyW
08-26-2002, 07:42 PM
Use this for the link and the link will open in a new window.


<a href="today.htm" onClick="this.href=daylinks[today];return true" target="_blank">CLICK
HERE and Visit Today's Site</a>

robchelle2
08-26-2002, 08:23 PM
Thank you Roy, but I tried that and it doesn't work. Any other suggestions?

beetle
08-26-2002, 08:30 PM
My apologies. I answered the wrong question! Here is what you need

<a href="javascript:;" onClick="window.open(daylinks[today],'_blank','');">CLICK HERE and Visit Today's Site</a>or
<script>
document.write('<a href="'+daylinks[today]+'" target="_blank">CLICK HERE and Visit Today's Site</a>');
</script>

robchelle2
08-26-2002, 08:40 PM
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?

Skyzyx
09-25-2002, 08:11 AM
If you're talking about a CSS Class, it would be:


<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:


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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum