Hey guys,
quick question. I have a html document portion with the following lines in it
and a Javascript Document "cookie.js" file
For some reason, the .htm file will not recognise the "loggedon" variable created in the "cookie.js" file. My background is in C, and i am HOPING that by including the ".js" file in the .htm document, it acts as a type of "header file" incorporating the global variables, and global functions of this file. I cant work out why it believes the variable is undefined, unless this is not the case.
Is there a way to do this without resorting to dumping all of my javascript code into the "htm" file?
Thanks In Advance Again
Cheers
Adam
quick question. I have a html document portion with the following lines in it
Code:
<script LANGUAGE="JavaScript" type="text/javascript" src="cookie.js"></script> <script LANGUAGE="JavaScript" type="text/javascript"> function bodyload() { if (loggedon != true) { checklogin(); } if (loggedon == true) { reloadimg(); } else { hasloggedon();} } </script> </head> <body onload="bodyload()">
Code:
var loggedon = false; function checklogin() { if (loggedon == true) return true; else { if (cookie_set != true ) testSessionCookie(); { if ( readCookie() == true ) //already logged in { loggedon = true; return true; //let them navigate to that page } else { loggedon = false; return false; //they must goto login page } } } }
Is there a way to do this without resorting to dumping all of my javascript code into the "htm" file?
Thanks In Advance Again
Cheers
Adam
Comment