diff options
| author | kx <kx@radix-linux.su> | 2026-10-17 16:39:23 +0300 |
|---|---|---|
| committer | kx <kx@radix-linux.su> | 2026-10-17 16:39:23 +0300 |
| commit | ec1891d58b9514b621725620453cec0e31e18389 (patch) | |
| tree | 6721f92c0afae3d933343b4a573ac8e5389827c6 /examples/script-file/change-color.js | |
| parent | 73d23259a690cd29c0ac74a4de963e23ecfebfac (diff) | |
| download | svgc-trunk.tar.xz | |
Diffstat (limited to 'examples/script-file/change-color.js')
| -rw-r--r-- | examples/script-file/change-color.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/examples/script-file/change-color.js b/examples/script-file/change-color.js new file mode 100644 index 0000000..e831b22 --- /dev/null +++ b/examples/script-file/change-color.js @@ -0,0 +1,13 @@ +/* JavaScript source only: do NOT add <defs>, <script> or CDATA tags. */ + +function changeColor(event) +{ + event.target.style.fill = 'blue'; +} + +document.addEventListener('DOMContentLoaded', function () +{ + var circle = document.querySelector('circle'); + if (circle) + circle.addEventListener('click', changeColor); +}); |
