Javascript not working in html file -


i have written code basic registration page run on webserver javascript doesn't seem working in html file. form post javascript function find errors seems ignoring javascript code when test it. there problem javascript code or in html code? code shown below.

<script type="text/javascript" language="javascript">      function checkpasswordmatch(){         var password = document.getelementbyid("pass1").value;         var password2 = document.getelementbyid("pass2").value;          if(password != password2){             document.getelementbyid("divcheckpasswordmatch").innerhtml = "passwords not match!";}         else{             document.getelementbyid("divcheckpasswordmatch").innerhtml = "passwords match.";}     }  //  $(document).ready(function(){ //      $("#pass2").keyup(checkpasswordmatch); //  })      function error() {         var user = document.getelementbyid("user").value;         var pass1 = document.getelementbyid("pass1").value;         var pass2 = document.getelementbyid("pass2").value;         var email = document.getelementbyid("email").value;          if(user=""){             document.form1.username.focus();             document.getelementbyid("usernameerror").innerhtml = "enter username.";             return false;         }         if(pass1=""){             document.form1.password1.focus();             document.getelementbyid("passworderror1").innerhtml = "enter password.";             return false;         }         if(pass2=""){             document.form1.password2.focus();             document.getelementbyid("passworderror2").innerhtml = "enter password.";             return false;         }         if(email=""){             document.form1.useremail.focus();             document.getelementbyid("emailerror").innerhtml = "enter email";             return false;         }      }      </script>     </head>     <body>      <div id="link">     <a href="/" align="right">home</a>     <a align="right" href="signin">sign-in</a>     </div>      <div id="header">     <center><h1><i>imgcapture</i></h1></center>     </div>      <div id="create">     <center><h2>create account</h2></center>  <form name="form1" action="account" onsubmit="return error()" method="post">     <div id="username"><center><h3>enter username:  <input type="text" name="username" id="user" cols="15" rows="1"></input></h3></center></div>     <div id="usernameerror"></div>     <div id="password"><center><h3>enter password:  <input type="password" name="password1" id="pass1" cols="15" rows="1"></input></h3></center></div>     <div id="passworderror1"></div>     <div id="confirmpassword"><center><h3>re-enter password:  <input type="password" name="password2" id="pass2" onchange="checkpasswordmatch()" cols="15" rows="1"></input></h3></center></div>     <div id="passworderror2"></div>     <div class="registrationformalert" id="divcheckpasswordmatch"></div>     <center><h3>enter email:  <input type="email" name="useremail" id="email" cols="15" rows="1">     </input></h3></center>     <div id="emailerror"></div>     <center><input type="submit" value="create account" onclick="error()"></input></center> </form>      </div>     </body>     </html> 

it may not calling functions creating. since not calling functions arguments, nothing inside them going happen. let me know if fixes it.

also, stylistically want javascript code @ end of html file.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -