Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Function decided to stop working - event not attaching
Old 05-10-2005, 10:36 AM Function decided to stop working - event not attaching
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
Can anyone see whats wrong here? This was working a minute ago - and I don't remember changing anything!

Whats supposed to happen is that the password is hashed with a challenge in txtChallenge and the plain text password field replaced with that hash before the form submits. It looks like the function isn't even fireing... (I stuck an alert in on the first line of the function and it didn't show)

HTML Code:
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
	<head>
		<title>Login Test</title>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
		<script type="text/javascript" src="md5.js"></script>
		<script type="text/javascript">
		<!--
			cmdLogin.onclick = getResponse();

			function getResponse() {
				// Set up some variables
				var theform;
				var challenge;
				var response;
				var password;
				var toHash;

				// Get the form
				if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
					theform = document._ctl0;
				}
				else {
					theform = document.forms["_ctl0"];
				}

				// Generate the hash
				challenge = theform.txtChallenge.value;
				password = theform.txtPassword.value;
				toHash = password + challenge;
				response = hex_md5(toHash);

				// Set the form values
				theform.txtPassword.value = response;
			}
		// -->
		</script>
 	</head>

	<body>
		<h1>Login</h1>
		<form name="_ctl0" method="post" action="login.aspx?ReturnUrl=%2fprotected%2findex.aspx" id="_ctl0">
<input type="hidden" name="__VIEWSTATE" value="dDwxNzI3MTQ4OTU7Oz52+oy1BwCxx49fAld7lOOdnqNufw==" />

			<span>Username: <input name="txtUsername" type="text" id="txtUsername" /></span><br />
			<span>Password: <input name="txtPassword" type="password" id="txtPassword" /></span><br />
 			<input name="txtChallenge" id="txtChallenge" type="hidden" value="cd0e7eL2ajqIZhBkTyfiqe8=" />
			<input type="submit" name="cmdLogin" value="Login" id="cmdLogin" /><br />
			
		</form>
	</body>
</html>
 
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Last edited by Minaki; 05-10-2005 at 10:39 AM..
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
 
Register now for full access!
Reply     « Reply to Function decided to stop working - event not attaching
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 4.47507 seconds with 12 queries