Last active
April 26, 2016 20:17
-
-
Save easikoglu/54cac6d40e4918d1f80b to your computer and use it in GitHub Desktop.
Inspect element mauseover
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
function mouseOverColor(evt) | |
{ | |
var element = evt.target; // not IE | |
// set the border around the element | |
element.style.borderWidth = '2px'; | |
element.style.borderStyle = 'solid'; | |
element.style.borderColor = '#f00'; | |
} | |
function mouseOutColorRemove(evt) | |
{ | |
evt.target.style.borderStyle = 'none'; | |
} | |
function mouseOnClick(evt) | |
{ | |
var selection = evt.target.innerHTML; | |
console.log('Element is: ' + evt.target.toString() + '\n\nSelection is:\n\n' + selection); | |
return false; | |
} | |
document.addEventListener("mouseover", mouseOverColor, true); | |
document.addEventListener("mouseout", mouseOutColorRemove, true); | |
document.addEventListener("click", mouseOnClick, true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment