metanohi-misc-subsites/subsites/lunchuman/static/front.js

20 lines
517 B
JavaScript
Raw Normal View History

2012-02-28 11:37:03 +01:00
create_listener = function(elem) {
var listener = function() {
elem.value = '';
elem.removeEventListener('focus', listener, false);
};
return listener;
}
prepare_delete_onfocus = function() {
var elems, elemI, elem, listener;
elems = document.getElementsByClassName('deleteonfocus');
for (elemI in elems) {
elem = elems[elemI];
elem.addEventListener('focus', create_listener(elem), false);
}
}
window.onload = function(event) {prepare_delete_onfocus();}