Saturday, March 19, 2011

SOFT6008 Cookie Tips

I went through this a few times in the labs, but it's worth going over it again.

The steps I would take to get the cookie page working would be as follows

[Don't use any functions]
Prompt for the name
Code to write name to cookie
Check that it works by displaying the browsers cookies
Add the expiry date
Check it works
Code to read the cookie that was just written
Output name

Now reorganize the code so that it reads first
If the name is successfully read then output it
If it's not there (indexOf = -1) then prompt for the name and write it

No comments: