wrote:
> I have this code which uses Prototype functions:
http://www.javascripttoolbox.com/bes...ces/#prototype
> Event.observe(window, 'load', usinit, false);
> function usinit(){
> $('submit').style.display = 'none';
> Event.observe('UserUsername', 'keyup', warn, false);
> }
> The problem is I need to make that code re-usable, right now I have to
> define the target and form key in the functions and thus would need to
> create many functions for a form.
Try:
Event.observe(window, 'load', function(){ usinit('submit'); }, false);
function usinit(id){
$(id).style.display = 'none';
Event.observe('UserUsername', 'keyup', warn, false);
}
and extend the same concept to the other function.
--
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com