Net4TV
Front
News
Features
Op n' Ed
Voxpop
Community
Archive
Subscription


Switch background color
<IMG SRC="graphics/section/voice_voice.jpg" Width="448" Height="90" border=0>
How-To Feature
A Clock For Your Homepage or Chat


By Diane Dumas
(June 20, 1999)

Hey Boy and Girls! Do you know what time it is? It's time for a clock! If you have the time, here's the code for an easy clock add-on for your personal IRC chat or homepage!

This clock displays not only the time, but the date as well! You can even set the alarm with a message, and alert you with the sounds of Big Ben (or any alarm sound that you have in your directory)!

When the clock is highlighted, it will display the date (month and day). Click the clock and you can set the alarm. You will be prompted to type a message that displays when the alarm goes off.

This is a simple add-on to the code you already have in your IRC chat or homepage. Just copy and paste the SCRIPT and BODY portions of this code to your own page. If you have SCRIPT tags already, just remove them from this code. You should have BODY tags themselves on your page, so don't use them from this code either if you have.

Add the BODY portion of this Clock anywhere you wish the Clock to be displayed on your page or chat. You can also change the sound the Alarm makes by changing the the URL addy in the embed src in the BODY, and location.href in the SCRIPT, to your own WAV file.

Cut & Paste Code

<SCRIPT>
// Date/Time/Alarm Clock By: Diane Dumas 1999
set=""
showtime()
function showtime(){
now=new Date()
hours=now.getHours()
minutes=now.getMinutes()
if (hours > 11) {hours=hours-12}
if (hours == 0) {hours=12}
timeValue = ((hours < 10) ? " " : "") + hours
timeValue += ((minutes < 10) ? ":0" : ":") + minutes
document.clock.time.value=timeValue
if(timeValue == set){
set=""
location.href="http://members.tripod.com/~dianedumas/wav/bigben.wav"
alert(message)
}
timerID=setTimeout("showtime()",1000)
}
function setalarm() {
if(set){
checkalarm()
}else{
set=prompt("Set Alarm: set time in HH:MM format.\nExample 11:01 {"+timeValue+"}");
if(set && !null)
if(set.indexOf(":") != -1 && set.length > 3) {
message=prompt("Please type in message you want\nAlarm to alert you with.")
if (set.length < 5) {set=" "+set}
}else{
alert("ALARM SET ERROR\n\nAlarm NOT Set!"); set=""
}
}
}
function date() {
WS1(); clearTimeout(timerID); day=new Date()
today=(day.getMonth()+1)+"/"+day.getDate()
if (today.length < 5){today=" "+today}
document.clock.time.value=today
}
function enddate() {
WS0(); clearTimeout(timerID); showtime()
}
function checkalarm() {
if(!confirm("Alarm Set: "+set+"\n\nPress Cancel\nto Cancel Alarm")){set=""}
}
function WS0() {
window.status=""
}
function WS1() {
window.status="Displays Date & Time / Click to Set Alarm" }
</SCRIPT>


<BODY>
<center>
<table><tr>
<td>
<form name="clock" action="javascript:setalarm()//">
<input type="text" name="time" bgcolor=181818 cursor=181818 text=gold value="Clock" size=5 onFocus="date()" onBlur="enddate()">
</form>
</table>
</center>
<embed src="http://members.tripod.com/~dianedumas/wav/bigben.wav" hidden>
</BODY>


To Top of Page

Welcome to Net4TV Voice
Meet your fellow users who create
Net4TV Voice in the Masthead.

View our Privacy Policy.


Net4TV, Net4TV Voice, Chat4TV, and Surfari
are trademarks of Net4TV Corporation
© 1998 - 2001, Net4TV Corporation. All Rights Reserved.