Hi.

I'm sure I've asked this before, but I can't remember.

Is there any benefit in using named functions over anonymous functions
for something like this ...

document.observe
        (
        'dom:loaded',
        function()
                {
                $$('.EditNumber')
                        .invoke
                                (
                                'observe',
                                'focus',
                                function(e)
                                        {
                                        this.writeAttribute('Before', 
this.value);
                                        }
                                )
                        .invoke
                                (
                                'observe',
                                'blur',
                                function(e)
                                        {
                                        this.value = parseFloat(this.value, 
10).toFixed(2);
                                        if (isNaN(this.value))
                                                {
                                                this.value = 
this.readAttribute('Before');
                                                }
                                        }
                                );
                }
        );

The idea is to allow a text input field to contain a number (in which
case it will be 2DP) or text.

This is working in FF and IE, so this is a stylistic question rather
than a coding problem.




-- 
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to