Wade Preston Shearer wrote:
> On 8 Dec 2008, at 23:12, Richard K Miller wrote:
>
>> Does this work?
>>
>> $('tr').hover(banana, banana);
>>
>> This passes the functions themselves instead of the values that the
>> functions returned.
>
> Interesting; it does. My problem isn't solved however because in my real
> code (my example was simplified), I need to pass values into the
> functions like this:
>
> $('tr').hover(banana(a,b), banana(a,b));
Try:
$('tr').hover(function () {banana(a,b);}, function () {banana(a,b);});
The real code might be helpful.
The 2 main things to understand are:
- the difference between passing a function and passing the return of a
function
- the way scope works on javascript
Check out this:
http://www.jibbering.com/faq/faq_notes/closures.html
Alvaro
_______________________________________________
UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net