Skip to content

Instantly share code, notes, and snippets.

@devdays
Created November 30, 2014 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devdays/beb4903a885d92dce988 to your computer and use it in GitHub Desktop.
Save devdays/beb4903a885d92dce988 to your computer and use it in GitHub Desktop.
SVG Events
<!DOCTYPE html>
<html>
<head>
<title>Click in SVG</title>
</head>
<body>
<h1>SVG User Interface</h1>
<!-- Create the SVG pane. -->
<svg height="100" width="100">
<!-- Create the circle. -->
<circle cx="75" cy="75" r="50" fill="green" id="myCircle" onclick="circleClick();" />
<text>Click on green circle.</text>
</svg>
<script type="text/javascript">
// This function is called when the circle is clicked.
function circleClick() {
// Display the alert.
alert("You clicked the SVG circle.");
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment