Walks the sample code for element attributes within a DOM object
- 2020-03-30 01:38:01
- OfStack
Direct code:
For example, to get all the attributes of a button with id "BTN"
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);
}