Jump to content

[SOLVED] Change text every 60 seconds.


lynxus

Recommended Posts

Hi guys,

Ive got a script on my page that when a user loads the page it places a random tip of the day.

 

My question is:

How can i get this to just update every 60 seconds?

I sould assume it would be something needed to call the javascript every 60 seconds.

and then something like

document.totd.value = totd.js ?

Or something like that?

 

Could someone help please. Im crap with javascript lol.

 

Thanks

Graham

 

 

<div id="totd"><script src="totd.js" type="text/javascript"></script></div>

 

// JavaScript Document


var quotes = new Array;

quotes.push("Click Go Online to start recieving messages from your users.");

quotes.push("Click My Website Code to see any new buttons for your site.");

quotes.push("Keep missing chat requests? Try the SMS / TXT message alert option.");

quotes.push("Add your Status Icon to more that one page on your site to increase your chances of a support request.");

quotes.push("Responding to your visitors chat requests fast will increase your chances of a sale.");

quotes.push("Click Go Online to start recieving messages from your users");

document.write(quotes[(Math.floor(Math.random() * quotes.length))]);

Link to comment
Share on other sites

"document.totd.value = totd.js"

 

is your phrase inside any tags? value would work if you had it within a text input or something... otherwise you could put it inside of a div, with an id (like totd):

 

<div id="totd">This is a tip</div>

 

which would allow you to use innerHTML:

 

document.getElementById('totd').innerHTML = quotes[(Math.floor(Math.random() * quotes.length))];

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.