window.onload=function(){
var elems = document.getElementsByTagName('input');
for(var i=0; i<elems.length; i++){
if( (elems[i].type == "text" || elems[i].type=="password") && !elems[i].readOnly){
if(window.ActiveXObject) {elems[i].attachEvent("onfocus", (function(el){return function() {clearDefault(el)}})(elems[i]))
}
else {elems[i].addEventListener("focus", (function(el){return function() {clearDefault(el)}})(elems[i]), false)
}
};
}
}
Вам нужно
почитать про замыкания.