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() });
</script>
Otherwise, what T.J. said.
//jarkko
--
Jarkko Laine
http://jlaine.net
http://dotherightthing.com
http://www.railsecommerce.com
http://odesign.fi
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.