方法一:
New Document
");
};
//在随机位置插入一个随机的id
i = parseInt(Math.random() * 1000);
html[i] = html[i] + ("
" + rnd + "
");
document.write(html.join(""));
})();
方法二:
New Document
");
}
document.body.innerHTML = html.join("");
}
window.onload = function(){
createDiv();
var oID = {} , result = {}, arr = [],
tags = document.getElementsByTagName("*");
for(var i = 0, id; i id = tags[i].id;
if(id){
oID[id] = oID[id] ? oID[id] + 1 : 1;
if(oID[id] > 1){
result[id] = id + " " + oID[id]; } } } for(var o in result){
arr.push(result[o]);
}
alert(arr.join("/t"));
};