If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

pop up alert based on appointment time

I have developed scheduler in which admin can make appointments of a patient on paticular date & time,and i want alert pop up before 10min of appointment..i tried but wnt get...How to get pop up alert by using javascript..do we have to use thread programming???

Probably not optimal, but you can have a function that checks the time and sees if there are any appointments within 10 minutes. Popup a reminder if there is. Then you set this function to run periodically.

<script type="text/javascript">
var mins_alert=10;
function alert_func(){
alert("in "+mins_alert+" minutes you will have an appointment!");
caller();
}
function caller(){
//get the current date
var now = new Date();
//get the next event (these values should come from a database or somewhere, and be update each time that the caller function is run...)
var month_str="february";
var day=28;
var year=2013;
var hours=22;
var mins=57;
var secs=0;
var next_event = new Date(month_str+day+", "+year+" "+hours+":"+mins+":"+secs);
// alert("now:\n"+now);
// alert("next_event:\n"+next_event);
var delta_millisecs = next_event.getTime()-now.getTime(); //difference, in milliseconds, between these the current date and the date of the next appointment
var delta_t = delta_millisecs-mins_alert*60*1000; //number of milliseconds between now to the alert event
if (delta_t>0){
setTimeout("alert_func()", delta_t);
}
}
</script>