Removing JavaScript from a link
<p>The link's code is as follows:</p>

<pre><code>&lt;td class="buttonColumn"&gt;
&lt;a href="javascript:confirmDialog('Are you sure you want go?', 'http://google.com');" class="actionButtonNew"&gt;Leave to Google&lt;/a&gt;
&lt;/td&gt;

&lt;td class="buttonColumn"&gt;
&lt;a href="javascript:confirmDialog('Are you sure you want go?', 'http://yahoo.com');" class="actionButtonNew"&gt;Leave to Yahoo&lt;/a&gt;
&lt;/td&gt;
</code></pre>

<p>There are multiple buttons on the page with the exact same format that need to be changed as well. I was thinking something like this:</p>

<pre><code>var fix = document.getElementsByClassName('actionButtonNew');
for (var i=0; i&lt;fix.length; i++) {
</code></pre>

<p>I am not sure how to finish the code. I tried this:</p>

<pre><code>var fix = document.getElementsByClassName('actionButtonNew');
for(var i = 0; i &lt; fix.length; i++) {
    try {
        var l = fix[i];
        var h = fix[i].parentNode.getElementsByClassName('actionButtonNew')[0].href.replace("javascript:confirmDialog('Are you sure you want to go?',", "");
        l.href = h;
    } catch(e) {}
}
</code></pre>

<p>I know it is very messy and bad. It does change the link to: '<a href="http://google.com" rel="nofollow">http://google.com</a>'); </p>

<p>So I think I may be on the right track. Please help me. Thanks in advance!</p>
