function abc() { var a = document.getElementsByTagName('input'), b = []; for(var i=0; i<a.length; i++) if(a[i].value) b.push(a[i].value); return b; }