<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
var ms = 0;
var state = 0;
function start_wtc() {
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.stp_watch.time.value = ms;
}
}
function wt_reset() {
state = 0;
ms = 0;
document.stp_watch.time.value = ms;
}
function wt_display() {
setTimeout("wt_display();", 50);
if (state == 1) {
now = new Date();
ms = now.getTime() - then.getTime();
document.stp_watch.time.value = ms;
}
}
//-->
</SCRIPT>
<BODY onLoad="wt_display()">
<CENTER>
<FORM NAME="stp_watch">
<table border=1 cellpadding=4 bgcolor=#ffffe8>
<tr><td colspan=3 align=center bgcolor=blue>
<font color=yellow size=4 face = "century"><i>Stop Watch</i>
</td></tr>
<tr><td>
経過時間:
<INPUT TYPE="text" Name="time" size=10>
</td><td>
<INPUT TYPE="BUTTON" Name="ssbutton" VALUE="Start/Stop" onClick="start_wtc()">
</td><td>
<INPUT TYPE="BUTTON" NAME="reset" VALUE="Reset" onClick="wt_reset()">
</td></tr></table>
</FORM>
</CENTER>
</BODY>
</HTML>
|