Ciao a Tutti, ho questo Script di un timer:
codice:
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<FORM NAME="stpw">
<SCRIPT LANGUAGE="JavaScript">
<!-- INIZIO
var ms = 0;
var state = 0;
function startstop() {
if (state == 0) {
state = 1;
then = new Date();
then.setTime(then.getTime() - ms);
} else {
state = 0;
now = new Date();
ms = now.getTime() - then.getTime();
document.stpw.time.value = ms;
document.stpw.time1.value = ms;
}
}
function swreset() {
state = 0;
ms = 0;
document.stpw.time.value = ms;
document.stpw.time1.value = ms;
}
function display() {
setTimeout("display();", 50);
if (state == 1) {now = new Date();
ms = now.getTime() - then.getTime();
document.stpw.time.value = ms;
document.stpw.time1.value = ms;
}
}
// FINE -->
</SCRIPT>
</head>
<BODY onLoad="display()">
<CENTER>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="26%" id="AutoNumber1">
<tr>
<td width="36%"><input type="checkbox" name="checkbox" value="checkbox" ></td>
<td width="64%"><INPUT TYPE="text" Name="time" size="20"></td>
</tr>
<tr>
<td width="36%"><input type="checkbox" name="checkbox1" value="checkbox" ></td>
<td width="64%"><INPUT TYPE="text" Name="time1" size="20"></td>
</tr>
<tr>
<td width="36%">
<INPUT TYPE="BUTTON" Name="ssbutton" VALUE="Start/Stop" onClick="startstop()"></td>
<td width="64%">
<INPUT TYPE="BUTTON" NAME="reset" VALUE="Reset" onClick="swreset()"></td>
</tr>
</table>
</FORM>
</CENTER>
</body>
</html>
Come si vede ho inserito dei checkbox perchè vorrei tramite la loro attivazione/disattivazione far partire uno e non l'altro timer e viceversa......si può fare?
Grazie per l'aiuto. Ciao