why the hell the password matching funtion pwdCompare() is not working here ??and kindly tell me .. how to enabling the "forwarding" input box relating to radio button yes or no :( :( plz plz plz help me !!

<title>Email Control</title>
<link href="email-styles.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type = "text/javascript">

function pwdCompare() { // password matching function
var p1 = document.edit_email.password.value;
p1 = p1.replace(/^\s+/g, "");  // strip leading spaces
var p2 = document.edit_email.repassword.value;
p2 = p2.replace(/^\s+/g, "");  // strip leading spaces
if(p1 != p2)) {  
alert ("The two passwords do not match!!  Try again!");
document.edit_email.password.value = "";
document.edit_email.repassword.value = "";
return false;
else {
alert ("The passwords match!");


<table width="600" align="center">
<form  name="edit_email" action="savedata.php" method="post">
<table width="600" border="0" cellpadding="0" cellspacing="5">
  <tr><td class="emailtext">Password</td>
    <td><label for="password"></label>
      <input type="password" name="password" id="password"></td>
    <td class="emailtext">Re-Type Password</td>
    <td><label for="repassword"></label>
      <input type="password" name="repassword" id="repassword"  onBlur="pwdCompare()"></td>
    <td valign="top" bgcolor="#FFFFFF" class="emailtext">Forwarding Mails</td>
    <td bgcolor="#FFFFFF"><label>
      <input name="radiobutton" type="radio" value="yes">

<input name="radiobutton" type="radio" value="no"> 

      <span class="emailtext">To</span>
      <input type="text" name="forwarding" id="forwarding"></td>
    <td colspan="2" align="center" bgcolor="#FFFFFF"><input type="submit" name="submit" id="submit" value="SAVE">
      <input type="button" name="back" value="Back" onClick="window.location.href='index.php'">

Edited by Dani: Formatting fixed

7 Years
Discussion Span
Last Post by pearll

Use Code Tags and post only relevant code not whole bunch of it.
All I can see is JS code and this is PHP forum (wrong forum?)


sorry ... the closing tag of code has one slash missing ....... i dont knw how to edit now ..

and this is a php page just having one JS function ... and i have posted the only relevant codes ... the whole page has more codings !!!!!


Just something that stands out for me is the two end closing brackets in the if statement
you currently have this:

if(p1 != p2)) {

and you should have this?
if(p1 != p2) {

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.