As the title says, I'm trying to change the ID of all elements with the tag "div". Here's my current script, which does not work:
function setIDs() {
var divs[] = new Array();
for(i in document.getElementsByTagName('div'))
divs[i] = document.getElementsByTagName('div')[i];
for(idNum in divs) divs[idNum].id="child"+idNum;
}
So after setIDs() is finished, my HTML should look like this:
<div id="child0">...</div>
<div id="child1">...</div>
...
<div id="childn">...</div>