captured onclick function
<p>I have a page containing a series of tags like this</p>

<pre><code> &lt;a class="IMG" href="#" onclick="openWin(this,'./photos/Snapshot_20100803.jpg');return false;"&gt;&lt;img src="./photos/TN_Snapshot_20100803.jpg" alt="./photos/TN_Snapshot_20100803.jpg"/&gt;&lt;/a&gt; 
</code></pre>

<p>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</p>

<pre><code>cmd = z.onclick;
</code></pre>

<p>if I display cmd with alert(cmd) I see something like this</p>

<p>function onclick(event) {
    openWin(this, "./photos/Snapshot_20100804.jpg");
    return false; }</p>

<p>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.</p>

<p>What kind of thing have I glommed onto?</p>

<p>How can I manipulate it as a string?</p>

<p>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?</p>

<p>What I really want to do is click the a tag I found in the page.</p>
