i have a html form and with a few fields
i want to md5 my password field before posting it

here is my code

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><title>Employee Payroll System NIC-APSC</title>

<link rel="shortcut icon" href="images/favicon.ico">
<script language="javascript" type="text/javascript" src="md5.js">
function crypt()
{ 

document.form1.password.value = calcMD5(document.form1.password.value);

}
</script>
</head>
<body style="background-color: silver;">
<span style="font-weight: bold;"><img style="width: 987px; height: 159px;" alt="MAST" src="images/mast.GIF"><br>
</span>
<div style="text-align: center;"><span style="font-weight: bold;">
<h2>Fill in the Details in the appropriate fields</h2>
</span></div>
<span style="font-weight: bold;"><br>
</span>
<table style="text-align: left; margin-left: auto; margin-right: auto; width: 335px; height: 356px;" border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td><span style="font-weight: bold;">
<form name ="form1" action="ddoregisters.jsp" method="post">DDO
Number:<input name="ddono" type="text"><br>
<br>
DDO
Name
<input name="ddoname" type="text"><br>
<br>
Password:<input name="password" type="text"><br>
<br>
Confirm
Password:<input name="password1" type="text"><br>
<br>
<input name="okfunc" value=" Submit " type="submit" onClick="crypt();" >
</form>
<form action="ddo.html">
;<input value=" Return " type="submit"></form>
</span>
</td>
</tr>
</tbody>
</table>
</body></html>

can some one please tell why my password field in not being md5ied


thanx in advance

Ankurmawanda,
A script tag with src="..." cannot also contain its own code. You need a separate script tag.

<script type="text/javascript" src="md5.js"></script>
<script type="text/javascript">
function crypt()
{ 
document.form1.password.value = calcMD5(document.form1.password.value);
}
</script>

Then it should work but you won't see it happen because the form will be submitted and the page will refresh.

If you want to see the result of the md5 transform then you need to do things slightly differently:

<form name="form1" action="ddoregisters.jsp" method="post" onsubmit="return crypt();">


function crypt()
{ 
  document.form1.password.value = calcMD5(document.form1.password.value);
  return false;//return true to all ow the form to submit ; false to suppress form submission
}

Airshow