M
metasilk
Situation:
Many links with hrefs & some have ids in the HTML.
External javascript file.
Wanted:
When the mouse is hovering over a link with a certain id, do something
(such as display one particular image; which image depends on which
link).
Do this without having onmouseover attributes in the HTML.
Question:
Can I use addEventListener/attachEvent to make the script perceive
WHICH link is hovered over, and feed that link's id to some variable?
If so, HOW?
Note: If I specify "look for this link" (with
document.getElementById('link_id'), the script can listen for the
event. However, when I have more than one specified link_id, only the
last one has any effect. Also, if I write a for loop, so far the same
issue (only the last id has any effect, all the rest are ignored).
Hope this makes sense.
--metasilk
Many links with hrefs & some have ids in the HTML.
External javascript file.
Wanted:
When the mouse is hovering over a link with a certain id, do something
(such as display one particular image; which image depends on which
link).
Do this without having onmouseover attributes in the HTML.
Question:
Can I use addEventListener/attachEvent to make the script perceive
WHICH link is hovered over, and feed that link's id to some variable?
If so, HOW?
Note: If I specify "look for this link" (with
document.getElementById('link_id'), the script can listen for the
event. However, when I have more than one specified link_id, only the
last one has any effect. Also, if I write a for loop, so far the same
issue (only the last id has any effect, all the rest are ignored).
Hope this makes sense.
--metasilk