Created
December 4, 2023 04:39
-
-
Save battaglia01/45c5de6df02a9ac5a99e3610a7499b5a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200"> | |
<!-- JavaScript code within a <script> tag --> | |
<script type="application/javascript"> | |
<![CDATA[ | |
// Your JavaScript code here | |
function showMessage() { | |
alert('Hello, SVG with Script!'); | |
} | |
]]> | |
</script> | |
<!-- Rectangle with an onclick event calling the JavaScript function --> | |
<rect x="10" y="10" width="100" height="50" fill="blue" onclick="showMessage()" /> | |
</svg> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment