diff options
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); +}); |
