IT Community - Software Programming, Web Development and Technical Support

How can I setup a clock with defined alarm times which trigger another event?

This is a discussion on How can I setup a clock with defined alarm times which trigger another event? within the HTML, CSS and Javascript Coding Techniques forums, part of the Web Development category; How can I setup a clock with defined alarm times which trigger another event?...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > HTML, CSS and Javascript Coding Techniques

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 01-19-2008, 04:18 AM
kingmaker kingmaker is offline
D-Web Genius
 
Join Date: Jun 2007
Posts: 882
kingmaker is on a distinguished road
Send a message via Yahoo to kingmaker
Question How can I setup a clock with defined alarm times which trigger another event?

How can I setup a clock with defined alarm times which trigger another event?
__________________
The KINGMAKER
Makes Every Thing Possible

Stuffs (My Blog)
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-19-2008, 04:18 AM
GDevakii GDevakii is offline
D-Web Sr.Programmer
 
Join Date: Aug 2007
Posts: 138
GDevakii is on a distinguished road
Smile Re: How can I setup a clock with defined alarm times which trigger another event?

<script language="JavaScript"><!--
function makeAlarm()
{
for (i = 0; i<makeAlarm.arguments.length; i++)
{
time = makeAlarm.arguments[i];
this[i] = zero + (Math.floor(time)*60*60*1000) + (time - Math.floor(time))*100*60*1000;
}
alarms = i;
}

var now = new Date();
var zero = (new Date(now.getYear(),now.getMonth(),now.getDate(),0, 0,0)).getTime();
var myAlarms = new makeAlarm(0.00,8.59,11.59,23.59);

function checkAlarm() {
now = new Date();

for (var i=0;i<alarms;i++) {
diff = myAlarms[i]-now.getTime();
if (diff > 0 && diff < 1000*60)
alert(now);
}

setTimeout('checkAlarm()',1000*60); // check every minute
}

checkAlarm();
//--></script>
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Clock on a webpage that syncs with the Atomic clock. itbarota HTML, CSS and Javascript Coding Techniques 1 03-16-2008 08:33 PM
Setup a clock with defined alarm times which trigger another event itbarota HTML, CSS and Javascript Coding Techniques 1 03-04-2008 09:57 PM
Add two times together, 08:30 and 08:45 and get 17:15. itbarota HTML, CSS and Javascript Coding Techniques 1 02-17-2008 08:47 PM
TFS 2005 Setup Fails / Team Foundation Server Setup Fails bluesky Server Management 1 10-18-2007 02:39 AM
event.clientX and event.clientY is working in IE but not work in firefox? senraj HTML, CSS and Javascript Coding Techniques 2 08-08-2007 05:27 AM


All times are GMT -7. The time now is 12:04 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0