Toggle Action
Thursday April 2, 2009
Web pages are usually stateless - meaning that when someone visits a web page the page behaves the same regardless of what they did before.
To allow a web page to behave differently based on what has gone on before you need a way to save information about what has come before. The way to do this is to store a cookie on your visitor's computer that contains information about the past state of the page (or site) and then retrieve that information to determine what to do next. In this example we look at how to get a web page to toggle between two actions based on whether your visitor has come to the page an odd or an even number of times.
Toggle Action


No comments yet. Leave a Comment