it's work only once. at second button click, occured nothing.
if I change budilnik
variable at i_budilnik
or var budilnik
, occured nothing at first and other clicks!
Where is the problem?
<div><form name="alert"><input type="text" name="hour" /><input type="text" name="min"/><input type="button" value="ok" onclick="budilnik(this.form)"></form><font color=#660000 size=20 face=Tahoma><span id="hours"></span>
</div>
<script type="text/javascript">
function budilnik(form)
{
budilnik=1;
min=form.min.value;
hour=form.hour.value;
}
obj_hours=document.getElementById("hours");
function wr_hours()
{
time=new Date();
time_min=time.getMinutes();
time_hours=time.getHours();
time_wr=((time_hours<10)?"0":"")+time_hours;
time_wr+=":";
time_wr+=((time_min<10)?"0":"")+time_min;
time_wr=time_wr;
obj_hours.innerHTML=time_wr;
if (i_budilnik==1) {
if (min==time_min)
{
if (hour==time_hours)
{
alert('welldone');
budilnik=0;
}
}
}
}
wr_hours();
setInterval("wr_hours();",1000);
</script>