One day session for checkbox

I have this code in the page and it works great - however, I don't want the user to have to keep clicking this box once they have clicked it initially - I'd like the 'session' to last a day.

Please help:

<script>
function redirect(checkbox) {

if (checkbox.checked) {

window.location = 'Training-Resource-Library.htm';

}
}
</script>

<script language="JavaScript" fptype="dynamicanimation">
<!--
function dynAnimation() {}
function clickSwapImg() {}
//-->
</script>
<script language="JavaScript1.2" fptype="dynamicanimation" src="animate.js">
</script>

</head>

<body onload="dynAnimation()">



<p>&nbsp;</p>
<p>&nbsp;</p>


<input type='checkbox' onclick="javascript: redirect(this)" value="ON">&nbsp;&nbsp;&nbsp;&nbsp; <input type="submit" value="I ACCEPT THESE TERMS" name="B1">


</body>
RickardP_GSIAsked:
Who is Participating?
 
Dave BaldwinConnect With a Mentor Fixer of ProblemsCommented:
The standard way would be to set a cookie in the user's browser that expires in 24 hours.  Then every time they go to your pages, you check to see if it has expired or doesn't exist which is what happens when it expires.  If it's still good, you continue with the page.  If not you send them to the 'accept' page.

http://www.w3schools.com/js/js_cookies.asp

Although your code probably works, it is not using the currently accepted attributes for javascript sections.  You can look at the source for this page for more examples.
<script type="text/javascript">
... your code...
</script>
Or...
<script  type="text/javascript" src="animate.js"></script>

Open in new window

0
 
RickardP_GSIAuthor Commented:
Or better yet - I'd like this page to only show once - then when the user clicks the checkbox - it redirects them to a page - but I want the session for these two pages to last one day - so user doesn't have to keep clicking the checkbox each time the page shows up.
TEST.html
acceptTerms.js
0
 
RickardP_GSIAuthor Commented:
Ok i got the javascript worked out -  I just want the user to come to the page, accept the checkbox, continue to the designated page, and not have to keep checking the box  when they click back on this link -i don't want them to have to fill in their name, etc., just accept the terms, check the box, and move to another page.
TEST2.html
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
RickardP_GSIAuthor Commented:
once the user has accepted the terms and checked the box, the users gets directed to www.pavilioncafe.com - what i want it after they close the browser and they go back to the pavioioncafe.com - they don't have to check the accepted terms box.  I'm not even sure I have this set up correctl - and my brain is fried
0
 
Dave BaldwinFixer of ProblemsCommented:
Without setting a cookie and checking it, there is no way.  It's too late for me to do anymore on it tonight.  Maybe tomorrow.
0
 
RickardP_GSIAuthor Commented:
I wasn't totally happy with the solution - I gave up - but now don't have time to deal with it - thank you
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.