I have a page containing a series of tags like this
<a class="IMG" href="#" onclick="openWin(this,'./photos/Snapshot_20100803.jpg');return false;"><img src="./photos/TN_Snapshot_20100803.jpg" alt="./photos/TN_Snapshot_20100803.jpg"/></a>
openWin creates a window and displays the image when the thumb is clicked. That page also contains a 'next' button which calls a nextImage function in the parent page's script. nextImage hunts through the a class IMG tags and finds the following a tag with class IMG. But now I'm stuck. I've found the right a tag and have it in var z. I can get something ala
cmd = z.onclick;
if I display cmd with alert(cmd) I see something like this
function onclick(event) { openWin(this, "./photos/Snapshot_20100804.jpg"); return false; }
but I don't know what I have. I don't seem to be able to manipulate it as if it's a string using indexOf.
What kind of thing have I glommed onto?
How can I manipulate it as a string?
Is there some way I can define the function perhaps using eval() and execute it in the context of the tag in the page containing the a tag?
What I really want to do is click the a tag I found in the page.