Skip to content

Instantly share code, notes, and snippets.

@SaitoAtsushi
Created June 28, 2013 11:08
Show Gist options
  • Select an option

  • Save SaitoAtsushi/5883956 to your computer and use it in GitHub Desktop.

Select an option

Save SaitoAtsushi/5883956 to your computer and use it in GitHub Desktop.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>test</title>
<script type="text/javascript">
function setHandler() {
var tgt = document.getElementById('triangle');
tgt.addEventListener('mouseover', function(e) {
tgt.style.background='red';
});
tgt.addEventListener('mouseout', function(e) {
tgt.style.background='blue';
});
}
</script>
</head>
<body onload="setHandler();">
<div id="triangle" style="background-color: blue; width: 100em; height: 10em;">
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment