Customizing SMF > Tips and Tricks

Live clock in header

<< < (4/33) > >>

lucas-ruroken:
I can't view it in your forum  Joker™ ::)

Joker™:
http://www.simplemachines.org/community/index.php?topic=398860.msg2770969#msg2770969

lucas-ruroken:
Thanks, perfect.

Greetings ;)

Manu.G:
I want to use this for the forum I'm running too, but I don't know how to use it, cause I changed a lot.
Can you help me please?

That's the part where the clock in my forum is :)

--- Code: ---// display the time
    echo '
                    <span class="smalltext">' , $context['current_time'], '<br /><br />';
                template_language_select();
    echo '</td>';
--- End code ---

Thanks in advance for your help! :)

Joker™:
see the original code , you just need to replace this much.


--- Code: ---' , $context['current_time'], '
--- End code ---


--- Code: ---',timeformat(time(),'%B, %d, %Y'), '
<li id="clock">Loading...</li>
<script type="text/javascript">
function refrClock()
{
var d=new Date();
var s=d.getSeconds();
var m=d.getMinutes();
var h=d.getHours();
var am_pm;
if (s<10) {s="0" + s}
if (m<10) {m="0" + m}
if (h>12) {h-=12;am_pm = "pm"}
else {am_pm="am"}
if (h<10) {h="0" + h}
document.getElementById("clock").innerHTML=h + ":" + m + ":" + s + am_pm;
setTimeout("refrClock()",1000);
}
refrClock();
</script>

--- End code ---
give it one more try ;)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version