Display an Alert "Hello, [Name]" to our visitor, with a cookie that was set some time earlier.
The MooTools Cookie class makes it surprisingly easy to create, read, access, and purge cookies. The method Cookie.write()
takes a key, a value, and optionally an object of options; for instance, the option duration
takes an integer that represents the number of days a cookie should be kept by a visitor. Cookie.read(),
terribly simple in syntax, takes the key of the cookie value that we wish to read. If empty the value is, it returns false. And, of course, we could not properly purge any cookie without the handy Cookie.dispose()
whose first parameter is identical to read()
and second parameter will merge the passed object of options with the existing cookie object options.
<script type="text/javascript" src="mootools-1.3.0.js"></script> </head> <body> <form action="" method="get"> <span...