PDA

View Full Version : This code isn't working right.


phonexpo
04-16-2006, 10:35 PM
I can't find the thread where I got this code, but the problem is it gives the wrong day ie - Tuesday 17th of April 2006 00:08:55 A.M. :cross-eyed:

Here's the code, can someone fix it please?;

#########################################

Adds a clock to your navbar:




Install:
Edit navbar:
find:

<if condition="$show['pmstats']"><br /><phrase 1="$vbphrase[unread_x_nav_compiled]" 2="$vbphrase[total_x_nav_compiled]" 3="$session[sessionurl_q]">$vbphrase[private_messages_nav]</phrase></if>
add after:


<div id="clock">Loading...</div>
<script type="text/javascript">
try
{
function refrClock()
{
var d=new Date();
var s=d.getSeconds();
var m=d.getMinutes();
var h=d.getHours();
var day=d.getDay();
var date=d.getDate();
var month=d.getMonth();
var year=d.getFullYear();
var days=new Array("Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday");
var months=new Array("January","February","March","April","May","June","July","August","Septemb er","October","November","December");
var am_pm;
if (s<10) {s="0" + s}
if (m<10) {m="0" + m}
if (h<10) {h="0" + h}
if (h>12) {h-=12;am_pm = "P.M."}
else {am_pm = "A.M."}
document.getElementById("clock").innerHTML=days[day] + " " + date + "th of " + months[month] + " " + year + " " + h + ":" + m + ":" + s + " " + am_pm;
setTimeout("refrClock()",1000);
}
refrClock();
}
catch (error)
{
alert(error.description);
}
</script>

Save and done!


##############################################

peterska2
04-16-2006, 10:51 PM
At a guess, you are talking about this hack

Clock in navbar (https://vborg.vbsupport.ru/showthread.php?t=109509&highlight=clock+navbar)

I recommend asking in that thread.

BTW, the fact that it says "Adds a Clock to your navbar" sorta gives away where you got the code. A quick search would have revealed the exact same result.

phonexpo
04-16-2006, 10:56 PM
BTW, the fact that it says "Adds a Clock to your navbar" sorta gives away where you got the code. A quick search would have revealed the exact same result.

Well yeah it does give it away, but I was searching for "Time" & "Navbar" that's probably why I couldn't find it. It's not exactly a clock more the time IMO.

But thanks.