javascript not working when externally linked
Posted: Wed Aug 27, 2008 10:45 am
I'm having a weird problem. I'm using some javascript functions to do client side encryption for a login form. Everything works perfectly when I have the javascript copied out between script tags in the header, but when I do an external link to the file with the exact same code, it doesn't work at all. I've used javascript before and haven't encountered this problem, and i can't seem to figure out what is different in this page that could be interfering. The script is in a file called encrypt.js in the same folder...I literally can copy and paste it between the script tags and it works...it's mostly MD5 encryption functions, and a function for doing CHAP login authentication (I didn't write it, borrowed from an internet tutorial, but I do understand how it works). I have the same problem in Firefox and IE 7, and I've tried changing the order of the attributes or removing some in the script tag but it didn't make a difference.
Can anyone help?
Can anyone help?
Code: Select all
<?php
// session holds encrypted challenge code
session_start();
$_SESSION['challenge']=md5(rand(1,100000));
?>
<html>
<head>
<title>Login</title>
<style type="text/css" media="all">@import "css/style.css";</style>
<script type="text/javascript" language="JavaScript" src="encrypt.js"></script>
</head>
<body>
<noscript><p><font color="red">it appears that you have javascript turned off in your browser.
You must enable javascript or you won't be able to log in.</font></p></noscript>
<form method="post" onSubmit="return doCHAP()" action="login.php">
User ID <input type="text" size="15" name="username" id="username"/><br />
Password <input type="password" size="15" name="pass" id="pass"/><br />
<input type="hidden" name="challenge" id="challenge" />
<input type="submit" name="login" value="Log In" />
</form>
</body>
</html>