Created
May 23, 2016 10:30
-
-
Save nasitra/e491438ec87c97daca7e149a0d233165 to your computer and use it in GitHub Desktop.
Access JavaScript function in SVG
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title></title> | |
</head> | |
<body> | |
<div id="container"> | |
<object data="image.svg" type="image/svg+xml" style="pointer-events: none;"> | |
</div> | |
<script> | |
document.getElementById('container').onclick = function() { | |
var object = document.querySelector('object'); | |
object.contentDocument.fillRandomColor(); | |
}; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment