Click to See Complete Forum and Search --> : script help again


don
05-29-2003, 07:31 PM
Hi every one

I found this script on the net (see below)

that I use on http://www.jervis-bay-nsw.com.au as feartured site of the day

it gives you a different site each day for 7 days
What i tryed to do is add another site so there would be 8
so changed the 7 in script to 8 and add new url but gave error and wouldnt work

would any one be able to view script and adjust or give me another script that gives differnt site each day then start at 1 again when finshed how evewr many sites there is

any help wil be much appricated

Regards
Don

<script language="JavaScript">
//******************************************************
// * Script from http://ldpoint.com
// * Phone and internet services, tools*
// * You can use this code if you leave this message*
// ******************************************************
function GetTodaysURL()
{
var locationlist = new URLList
(
"http://www.bluepointhouse.com.au/", // Monday
"http://www.baybeachcomber.com.au/", // Tuesday
"http://www.mmguesthouse.com/", //Wednesday
"http://www.theseychelles.com.au/", //Thursday
"http://www.thehuskypub.com.au/", //Friday
"http://www.dolphincruises.com.au/", //Saturday
"http://www.shoalhaven.net.au/~suenorm/" // Sunday
);

now = new Date();
num = now.getDay();
if (num == 0) num = 7;

location.href = locationlist.list[num-1];
}

function URLList ()
{
var argv = URLList.arguments;
var argc = argv.length;
this.list = new Object();
for (var i = 0; i < argc; i++)
this.list[i] = argv[i];
this.count = argc;
return this;
}
</script>

Jona
05-29-2003, 09:05 PM
Um... Add one more URL string to the Array (with a comma after the last quote before the //Sunday). And change this:

if (num == 0) num = 8

Jona

don
05-29-2003, 09:53 PM
Thanks Jona
That fixed the problem
when I first did it I forgot to put in comma

Your quick reply and help much appreicated
Regards
Don

Jona
05-29-2003, 09:55 PM
Actually, my reply was quite waited out.

Jona

don
05-31-2003, 08:34 PM
Hi again
Jona kindly gave me fix for error on below script so it would work.
but have found that it running only in seven day cycle.
it jumps from

"http://www.dolphincruises.com.au/", to

"http://www.raywhitejb.com.au/" missing the two in between. saw ray white was up for today so tested by changing date on computer and it was jumping the 2 url in between.
any ideas on problem
regards
Don

ps please refer to original script in this post as I deleted the day text from it




<script language="JavaScript">
//******************************************************
// * Script from http://ldpoint.com
// * Phone and internet services, tools*
// * You can use this code if you leave this message*
// ******************************************************
function GetTodaysURL()
{
var locationlist = new URLList
(
"http://www.bluepointhouse.com.au/",
"http://www.baybeachcomber.com.au/",
"http://www.mmguesthouse.com/",
"http://www.theseychelles.com.au/",
"http://www.thehuskypub.com.au/",
"http://www.dolphincruises.com.au/",
"http://www.shoalhaven.net.au/~suenorm/",
"http://www.professionalsjb.com.au/",
"http://www.raywhitejb.com.au/"
);

now = new Date();
num = now.getDay();
if (num == 0) num = 9;

location.href = locationlist.list[num-1];
}

function URLList ()
{
var argv = URLList.arguments;
var argc = argv.length;
this.list = new Object();
for (var i = 0; i < argc; i++)
this.list[i] = argv[i];
this.count = argc;
return this;
}
</script>

Charles
05-31-2003, 09:19 PM
Your script uses the Date.getDay() method and that can only have one of seven values. You need a complete redesign. This method should work.

<script type="text/javascript">
<!--
Date.ONE_SECOND = 1000;
Date.ONE_MINUTE = Date.ONE_SECOND * 60;
Date.ONE_HOUR = Date.ONE_SECOND * 60;
Date.ONE_DAY = Date.ONE_HOUR * 24;

var URL = ['http://www.bluepointhouse.com.au/', 'http://www.baybeachcomber.com.au/', 'http://www.mmguesthouse.com/', 'http://www.theseychelles.com.au/', 'http://www.thehuskypub.com.au/', 'http://www.dolphincruises.com.au/', 'http://www.shoalhaven.net.au/~suenorm/', 'http://www.professionalsjb.com.au/', 'http://www.raywhitejb.com.au/'];

URL.forToday = function () {return URL[Math.floor(new Date().getTime() / Date.ONE_DAY) % URL.length]}

document.write('<a href="#">The cool site for today.</a>');
document.links[document.links.length-1].href = URL.forToday();
// -->
</script>

don
05-31-2003, 09:32 PM
Thank you Charles for the script have placed on www.jervis-bay-nsw.com.au just have to adapt to button.
works well

regards
Don

don
05-31-2003, 09:39 PM
iam having trouble adapting your script to featured site of the day button could you please have a look at source and see were iam going wrong

www.jervis-bay-nsw.com.au

this is script on button <a Href="javascript:GetTodaysURL()">
regards
Don

Jona
05-31-2003, 11:36 PM
<input type="button" onClick="location.href=URL.forToday();" value="Get today's URL!">

don
06-01-2003, 03:09 AM
guys hate being a pain
but i cant gett it to work of my mouse over button.

Jona added your sugest but i added new button.

ineed it to work of gif click for feartured site of the day
and not have document.write The cool site of the day

this original link text


<a Href="javascript:GetTodaysURL()" OnMouseOut="isimgact( 'jbn19',0)" OnMouseOver="isimgact( 'jbn19',1)" >

www.jervis-bay-nsw.com.au

any advice will be appricated

regards
Don

Charles
06-01-2003, 05:17 AM
JavaScript will not work for the 13% of users who do not use it so you need to use a document.write() to make your image or button or link appear only when it is going to work. That said, I have no idea what you current problem is. Please clarify.

don
06-01-2003, 04:14 PM
Charles i need script to activate on gif click for feartured site of the day on page www.jervis-bay-nsw.com.au
as you will see in top left corner is the documentwrite text
cool site of the day dont need that ,

Iam completly lost on how to do this

This is old script www.jbonline.com.au it activates on "click for featured site of the day gif

I hope I have expalined it a bit better

regards
Don

Ps Iam a Baker by trade