View Single Post
Old 06-19-2011, 09:10 AM   PM User | #13
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,100
Thanks: 197
Thanked 2,421 Times in 2,399 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
To set a cookie which will expire in one hour:-

Code:
<script type = "text/javascript">

function createCookie(name, value){
var today = new Date;
today.setTime(today.getTime()+ 3600000);  // = 1 hour
document.cookie = name + "=" + value + "; expires=" + today.toGMTString();
alert (name + " value is: "+ value + "\nExpires in: " + today);
}

createCookie("myName", "myValue");

</script>
Then start by reading the cookie - if it is found do this, if it is not found do that.
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Philip M is offline   Reply With Quote