Most of the programmers using the comment
element = document.getElementById(id); to get the value or something from the HTML pages.Some times the ID may be changed because of some reasons.At that time we need to get the ID of the HTML element using Javascript and make our coding successfull.
Here I list the coding to get textarea id .
var divEls = document.getElementsByTagName("textarea");
var i = 0;
for(i=0;i<divEls.length;i++)
alert(divEls[i].id);
You can also using this type to get the Id of div.For that simply put the div instead of textarea.
Leave the comments to improve us...