Jump to content

Add a counting clock on header


Recommended Posts

Hi, i need some help with this

 

I would like to add a CLOCK (like "Today is 10/24/2013 - 2:29 PM") on the header (top of page) of my theme

 

How can i do that?

 

I have identified the block where it will go, only needs to know how add the code (and the code) i think could be with javascript... 

 

Could anyone help me please. Attached is an image for better reference.

 

comoreloj.jpg

 

I identified the TPL, its blockpermantlinks-header.tpl and i'll replace some content with this new clock function. 

 

Thanks!

 

 

 
Link to comment
Share on other sites

try with this code:

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
function showTime()
{
var today=new Date();
var h=today.getHours();
var m=today.getMinutes();
var s=today.getSeconds();
// add a zero in front of numbers<10
h=checkTime(h);
m=checkTime(m);
s=checkTime(s);
$("#clock").text(h+":"+m+":"+s);
t=setTimeout('showTime()',1000);
}
function checkTime(i)
{
if (i<10)
 {
 i="0" + i;
 }
return i;
}
showTime();
</script>

<div id="clock"></div>

insert <div id="clocl"></div> there where you want to display clock 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...