Hello;
I have a situation where an image tag is nested in an anchor tag set.
The anchor is assigned an id and is assigned a click/onclick event listener.
The anchor id corresponds to a list of objects in an array.
In practice, the image tag is receiving the event. The code does setAttribute in another elements img tag src attribute.
The image tag receiving the click event, (and passing it to the anchor tag)
is event.target. (or event.srcElement, in the case of I.E.)
My Question:
What I want to know is how to reference the event.target
parent element, the anchor tag elements Id attribute.
Code:
sample anchor/img tag set:
<a style="font-family:Arial, Helvetica, sans-serif;color:#cccccc" id="An 1" alt="An 1" href="javascript:"><img style="border:1px solid;border-color:#cccccc" src="WC_port/windows/img//an_1.jpg" width="100" height="131" /><br /><br />An 1</a>
I see the double slash in the img src path attribute. It is working as is
in test browser: Firefox ( so far)
This is in development stages. Later, I will assign the elements a css class
rule.
in my code, event.target.src has a usable value (src attribute of the img tag)
It does not have a usable value for event.target.id (id attribute of the anchor tag)
I am doing it this way so in the absence of javascript, the anchors href
attribute defaults to a non scripted value.
Thank you for time and attention
JK