On 9.6.2010, at 17.08, fernan wrote:

> Hi!
> I need to be able to i) read a cookie when the page loads, and ii)
> save data into the cookie when the page unloads (i.e. when the user
> clicks and navigates to another page, within the same site or to a
> different site).
> I have working code (in a catalyst web application) using <body
> onload="readCookie();" onunload="saveCookie();">.
> However, we want to move this code out of the <body> element, so we
> can only use it in some pages (the <body> tag is added by a global
> template for the site). So I started playing around with prototype's
> event.observe ... and can't get it to work.
> I just cooked a minimal test page to check what the problem might be,
> and can't figure out what I'm doing wrong.
> I'd appreciate any help or direction ...

The following worked fine for me (both Safari and FF):

   <script type="text/javascript" language="JavaScript">
     document.observe('dom:loaded', function() { $('div1').toggle() });

Otherwise, what T.J. said.


Jarkko Laine

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-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to