access text inside a button from js code example

Example 1: access text inside a button from js

document.getElementById("myButton2").innnerHTML=
   "New Button Text using innerHTML";

Example 2: access text inside a button from js

document.getElementById("myButton2").childNodes[0].nodeValue=
   "New Button Text using childNodes";

Example 3: html get button text

ar all = document.getElementsByTagName('*'); 
for (var i=0, max=all.length; i < max; i++) 
{
var elem = all[i];
if(elem.getAttribute("id") == 'ext-gen26'){
    if(elem.attributes != null){
        for (var x = 0; x < elem.attributes.length; x++) {
            var attrib = elem.attributes[x];
            alert(attrib.name + " = " + attrib.value);  
        }
    }
}
};