window.onload = function(){
var str = "";
var a = "";
//var a = 执行代码,返回第一个重复的id;
var tags = document.getElementsByTagName("*");
for(var i = tags.length-1; i > -1; i--)
{
var o = tags[i];
var id = o.id;
if (id && document.getElementById(id) != o)
{
a = id;
str+= a + ",";
}
}
alert(str);
}