Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Gives error on button click event

Status
Not open for further replies.

vishalonne

Technical User
Jul 29, 2012
49
Hello
When I click on Register button I get this error -
Message: Object expected
Line: 20
Char: 1
Code: 0
URI:
This is my registerform.php code -

HTML:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>register</title>
<script type="forms.js" type="text/javascript"></script>
<script type="sha512.js" type="text/javascript"></script>
</head>
<body  bgcolor="black"    style="color:white;">
<FORM ACTION="register.php" METHOD="POST">
<h1>welcome to the registration page</h1>
please input the registration details to create an account here<br>
<table border="2">
<tr>
<td>email :</td><td><input name="regemail" type="text" size"30"></input></td>
</tr>
<tr>
<td>password :</td><td><input name="regpass1" type="password" size"20"></input></td>
</tr>
</table>
<input type="button" value="Register" onclick="formhash(this.form, this.form.regpass1);" /> </input>
</FORM>
</body>
</html>
And this is my forms.ja code -

Code:
function formhash(form, password) {
  // Create a new element input, this will be out hashed password field.
  var p = document.createElement("input");
  // Add the new element to our form.
   
   p.name = "p";
   p.type = "hidden"
   p.value = hex_sha512(password.value);
   // Make sure the plaintext password doesn't get sent.
   password.value = "";
   // Finally submit the form.
   form.appendChild(p);
   form.submit();
}
 
Probably the fact your Js files are likely never getting loaded.

The correct property to use is src, not type, to load an external Js file.

Code:
<script [b][COLOR=#A40000]type[/color][/b]="forms.js" type="text/javascript"></script>
<script [COLOR=#A40000][b]type[/b][/color]="sha512.js" type="text/javascript"></script>

should be:

<script [COLOR=#0022A4][b]src[/b][/color]="forms.js" type="text/javascript"></script>
<script [COLOR=#0022A4][b]src[/b][/color]="sha512.js" type="text/javascript"></script>

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top