<html>
<head>
<title>Test</title>
<script type="text/javascript">
function uhr()
{
min=document.getElementById("minute").value;
sek=document.getElementById("sekunde").value;
if (sek=="" && min=="") sek=1;
document.getElementById("zeit").value=min+":"+sek;
timer=setTimeout("go()", 1000);
}
function go()
{
sek-=1;
if (sek==-1) {
sek=59;
min--;
}
if (sek<10)
sek="0"+sek;
if (min=="" && min==0)
min="0";
document.getElementById("zeit").value=min+":"+sek;
if (sek<=0 && min <=0) {
clearTimeout(timer);klingel();
}
else timer=setTimeout("go()", 1000);
}
function klingel() {
soundOn();
}
function abbruch()
{
clearTimeout(timer);
document.getElementById("minute").value="";
document.getElementById("sekunde").value="";
document.getElementById("zeit").value="";
}
function soundOn(){
if (document.layers) {document.midi.document.write("<embed src='dial.wav' autostart='true' hidden='true'>"); document.midi.document.close()}
if (document.all) midi.innerHTML="<embed src='dial.wav' autostart='true' loop='1' hidden='true'>"
}
function soundOff(){
if (document.layers) {document.midi.document.write(" "); document.midi.document.close()}
if (document.all) midi.innerHTML=" "
}
</script>
</head>
<body>
<div id="midi" style="position:absolute; visibility:hide; left:10px; top:10px; z-index:0"></div> <table cellspacing="0" cellpadding="0" width="100%"> <tr> <td>
Hier die abzulaufende Zeit eingeben<br> <input id="minute" style="width:50px"> Min <input id="sekunde" style="width:50px"> Sek
<br><br> <input type="button" value="Start" onclick="uhr()"> <input type="button" value="Abbruch" onclick="abbruch()"> <input type="button" value="Alarm aus" onclick="soundOff()"> <br><br>
Verbleibende Zeit: <input readonly="readonly" id="zeit" style="width:70px;font-weight:bold"> </td> </tr> </table> <p> <input type="button" value="Alarm Test" onclick="soundOn()">
</body>
</html>