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?

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>

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?

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>

Thanks man its solved now :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.