Stopwatch.js
This is a simple and lightweight library, that adds a stopwatch with an API to an HTML page.
Install / Use
/learn @Everhard/Stopwatch.jsREADME
stopwatch.js
This is a simple and lightweight library, that adds a stopwatch to an HTML page.
Here's a demo.
How to install
Just include the library into your HTML page:
<script src="js/stopwatch.js"></script>
How to use
Add some block element to your HTML and give it some ID:
<div id="stopwatch"></div>
Now create a StopWatch object using an ID as a parameter:
var stopWatch = new StopWatch("stopwatch");
That's it! Now your DOM was changed to the next structure:
<div id="stopwatch">
<span class="days">00</span>
<span class="hours">00</span>
<span class="minutes">00</span>
<span class="seconds">00</span>
<span class="milliseconds">000</span>
</div>
And you can customize the appearance whatever you like using CSS.
Control
| Method | Description |
|---------------------|--------------------|
| stopWatch.start() | Start a stopwatch. |
| stopWatch.pause() | Pause a stopwatch. |
| stopWatch.stop() | Stop a stopwatch. |
Properties
| Properties | Description |
|--------------------------|--------------------------------------------|
| stopWatch.milliseconds | The value of the milliseconds part. |
| stopWatch.seconds | The value of the seconds part. |
| stopWatch.minutes | The value of the minutes part. |
| stopWatch.hours | The value of the hours part. |
| stopWatch.days | The value of the days part. |
| stopWatch.isRunning | Set to true when a stopwatch is running. |
| stopWatch.isPaused | Set to true when a stopwatch is paused. |
Related Skills
node-connect
347.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
107.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
