Walks the sample code for element attributes within a DOM object


Direct code:

For example, to get all the attributes of a button with id “BTN”


function showBtn()
{
var tmp="";
var objBtn = document.getElementById("btn");
for(var i in objBtn)
{
tmp += i+":"+objBtn[i];
}
alert(tmp);
}