0

Hi....Friend i have to make this task......

create a time clock that display on the status bar and keep on changing every after 1 second. Kindly keep the format as given in the picture.

i have created code but i dont know how to put on status bar...
my code is

<script language="javascript">


var day = new Date();
var days = new Array(7);
var hours = day.getHours();
var minutes = day.getMinutes();
var zone;

days[0] = "Sunday";
days[1] = "Monday";
days[2] = "Tuesday";
days[3] = "Wednesday";
days[4] = "Thursday";
days[5] = "Friday";
days[6] = "Saturday";

if(hours>11)
{
	 zone = "pm";
}
else
	zone = "am"


document.write("today is = " + days[day.getDay()] + "the clock is ticking --> " + hours  + ":"  +minutes + zone);


</script>

can anyone tell me how to put this result on status bar?

2
Contributors
4
Replies
7
Views
5 Years
Discussion Span
Last Post by Farhad.idrees
0

Use window.status:

<script language="javascript">


var day = new Date();
var days = new Array(7);
var hours = day.getHours();
var minutes = day.getMinutes();
var zone;

days[0] = "Sunday";
days[1] = "Monday";
days[2] = "Tuesday";
days[3] = "Wednesday";
days[4] = "Thursday";
days[5] = "Friday";
days[6] = "Saturday";

if(hours>11)
{
	 zone = "pm";
}
else
	zone = "am"


window.status="today is = " + days[day.getDay()] + "the clock is ticking --> " + hours  + ":"  +minutes + zone;


</script>
0

Use window.status:

<script language="javascript">


var day = new Date();
var days = new Array(7);
var hours = day.getHours();
var minutes = day.getMinutes();
var zone;

days[0] = "Sunday";
days[1] = "Monday";
days[2] = "Tuesday";
days[3] = "Wednesday";
days[4] = "Thursday";
days[5] = "Friday";
days[6] = "Saturday";

if(hours>11)
{
	 zone = "pm";
}
else
	zone = "am"


window.status="today is = " + days[day.getDay()] + "the clock is ticking --> " + hours  + ":"  +minutes + zone;


</script>

my dear how to change everysecond in status bar?

0

Call a function from setInterval()

<script language="javascript">


var day = new Date();
var days = new Array(7);
var hours = day.getHours();
var minutes = day.getMinutes();
var zone;

days[0] = "Sunday";
days[1] = "Monday";
days[2] = "Tuesday";
days[3] = "Wednesday";
days[4] = "Thursday";
days[5] = "Friday";
days[6] = "Saturday";

if(hours>11)
{
	 zone = "pm";
}
else
	zone = "am"

function loop() {
window.status="today is = " + days[day.getDay()] + "the clock is ticking --> " + hours  + ":"  +minutes + zone;
}

setInterval("loop()",1000); 

</script>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.