25
rated 0 times
[
28]
[
3]
/ answers: 1 / hits: 24587
/ 13 Years ago, thu, february 16, 2012, 12:00:00
I expect this to print a because when I call foo(this)
, the argument seems to be the link tag.
<script type=text/javascript>
function foo (e) {
alert (e .tagName);
}
</script>
<a href=javascript:foo(this)>click</a>
Instead, it prints undefined. If I alert(e)
it says object Window. How do I make foo
know which element launched it? Without passing/looking up ids.
More From » html