我不完全明白你的问题,但看这确实你需要什么:
(function(global)
{
var $ = global.jQuery,
uniqueHREFs = {};
$(function()
{
var $matrixTable = $('#matrix'),
$matrixTableChildren = $matrixTable.children().detach();
$matrixTableChildren.find('a').each(function()
{
var $this = $(this),
HREF = $this.attr('href');
if(typeof uniqueHREFs[HREF] !== 'undefined')
{
$this.replaceWith(
$('<span>').addClass('duplicate-link-replacement').html($this.html())
);
}
else
{
uniqueHREFs[HREF] = true;
}
});
$matrixTable.append($matrixTableChildren);
});
}(window));
它重复你的表,将各击中HREF它以前没有见过的所有环节。当它碰到之前看到的一个时,它会用一个类别为duplicate-link-replacement
的跨度和链接以前具有的相同HTML取代它。
哦!这是一个好主意!谢谢JAAulde! – 2011-06-14 20:49:23
没有概率,感谢赞美:) – JAAulde 2011-06-14 21:46:25