删除的JavaScript链接的代码如下:从链接
<td class="buttonColumn">
<a href="javascript:confirmDialog('Are you sure you want go?', 'http://google.com');" class="actionButtonNew">Leave to Google</a>
</td>
<td class="buttonColumn">
<a href="javascript:confirmDialog('Are you sure you want go?', 'http://yahoo.com');" class="actionButtonNew">Leave to Yahoo</a>
</td>
有在页面上需要相应的更改多个按钮具有完全相同的格式。我在想这样的事情:
var fix = document.getElementsByClassName('actionButtonNew');
for (var i=0; i<fix.length; i++) {
我不知道如何完成代码。我试过这个:
var fix = document.getElementsByClassName('actionButtonNew');
for(var i = 0; i < 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) {}
}
我知道这是非常混乱和不好。它确实将链接更改为:'http://google.com');
所以我想我可能会走在正确的轨道上。请帮帮我。提前致谢!
你想要在链接被更改后实现什么功能(例如,没有链接,删除所有http:// ...)? – 2013-03-28 03:44:10
我想要链接指向网站。即:谷歌链接去http://google.com – MathMan08 2013-03-28 03:45:07
那么删除确认? – 2013-03-28 03:45:32