Try doing this instead:

//put the following in a script block near the bottom of your html
var foo = function(){ alert('howdy') };
Event.observe(window,'mouseup',foo);

Note that the function is called Event.observe, not Event.observer.  
Also any reference to a function inside of an observer needs to be in  
the form of an anonymous function, not a literal function itself. You  
could have done this as well:

Event.observe(window,'mouseup',function(){alert('howdy')});

It's a subtle distinction, but it becomes much more important in a non- 
trivial example, because an anonymous function won't get its input  
variables (and won't be called, either) until it is invoked. Then it  
"uncloaks", does its business, and vanishes again.

Walter

On Jan 2, 2009, at 1:30 PM, Per wrote:

>
> Hi,
> I'm new to protocoljs, but it's this thing I'm trying to do, and it
> doesn't work. It drives me mad.
>
> Anyway,
> I try to do this with protocoljs:
> <body onmouseup="alert('hi');">
>
> This was how I wrote it, but it doesn't work:
> Event.observer(window,'mouseup',alert('hi'));
>
> What is the right way to do it?
>
> Thank you!
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to