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.