I need to go through all INPUT tags and append another js function to be called.

Code:
var x = document.getElementsByTagName('input');
for (var i=0;i<x.length;i++) {
    x[i].onchange = function() {
        //new stuff to do					
    }
}
The code above overwrites the old onchange functions, but I need to add.


Any ideas?
Thank you.