Kor
12-28-2005, 10:23 AM
I want to check whether a certain element has attached a certain event. Maybe it is not the brightest ideea, but I tried to use getAttributeNode() method. Now I am confused by the way IE and Moz treat this method.
If:
<script type="text/javascript">
function check(id){
var obj = document.getElementById(id);
alert(obj.getAttributeNode('onMouseOver'))
}
</script>
IE shows me an object [object] while Moz shows me an attribute [object Att]
But if I use
obj.getAttributeNode('onMouseOver').nodeValue
Both show correctly the function triggered
Now that really confuses me, as I can not use a boolean to check whether an element has attached an event or not, because IE and Moz treat, as I have first said, getAttributeNode() in different manners.
Why so? Which of them is correct?
If:
<script type="text/javascript">
function check(id){
var obj = document.getElementById(id);
alert(obj.getAttributeNode('onMouseOver'))
}
</script>
IE shows me an object [object] while Moz shows me an attribute [object Att]
But if I use
obj.getAttributeNode('onMouseOver').nodeValue
Both show correctly the function triggered
Now that really confuses me, as I can not use a boolean to check whether an element has attached an event or not, because IE and Moz treat, as I have first said, getAttributeNode() in different manners.
Why so? Which of them is correct?