I'm trying to convert an on load event into a function. I think this
should be really simple, but I'm new to Javascript. The following
works fine as the page loads
var favorite = GetCookie('Demo Name');
if (favorite > '1')
{
window.location .href = 'page2.htm';
}
else
{
alert('You must complete the lesson before proceeding');
}
I have tried to make it into a function by adding
function CookieRedirect( ) {
at the top and a closing } at the end, and calling it using a form
button in the body:
<INPUT TYPE="button" VALUE="Redirect " onClick="Cookie Redirect ()">-
but no luck.
Any help much appreciated, Laura