0
Write a program to display current time in javascript which update itself every millisecond. Moreover. Change the color of......
Write a program to display current time in javascript which update itself every millisecond. Moreover. Change the color of time every half secomds. Need Help
3 Respuestas
0
For getting the time use...
var time = new Date();
To get it every millisecond, put it in a function and call it using...
setInterval(myFunction, 1);
To display the date/time in an easier format to read, use the modulus % operator. It outputs the remainder when dividing.
0
James ,
I think you read only half question .
change the color every half seconds?
0
To change the colour, add something like this into the function...
time.style.color = colors[x];
You'll need to make an array of colours. Then you can configure x however you like -- a loop, or using Math.random().