2017-05-18 4 views
2

私はしばらくの間これを探していましたが、私はこれについて何の答えも見当たりません。 基本的に、私はJSのパスワードを確認し、パスワードを確認するためのスクリプトを書いているが、そのスクリプトは全く呼び出されていない、私はESCキーを使用してポップアップを閉じるために別のスクリプトを書いても動作しません。私は何がうまくいかないのか分からない。どんな助けも非常に高く評価されるでしょう。前もって感謝します。最後にスクリプトを含むJavaScriptがcodeIgniterのビュー部分に書かれていません

<html> 
     <head> 
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
     <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"> 
     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
     <meta name="Sell Punch" content="true"> 
     <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> 
     <title>Sell Punch Login</title> 
     <link rel="stylesheet" type="text/css" href="http://localhost/Sell_Punch/assets/css/style.css"> 

     <script type="text/javascript"> 

     function ESCclose(evt) { 
      if (evt.keyCode == 27) { 
       console.log('escape pressed'); 
      } 
     } 
     </script> 

       <script> 

      var password = document.getElementById("password"), confirm_password = document.getElementById("repassword"); 

     function validatePassword(){ 
     if(password.value != confirm_password.value) { 
      confirm_password.setCustomValidity("Passwords Don't Match"); 
     } else { 
      confirm_password.setCustomValidity(''); 
     } 
     } 

     password.onchange = validatePassword; 
     confirm_password.onkeyup = validatePassword; 

     </script> 



     <script> 


     // Get the modal 
     var modal = document.getElementById('id01'); 

     // Get the modal 
     var modal = document.getElementById('id03'); 


     // When the user clicks anywhere outside of the modal, close it 
     window.onclick = function(event) { 
      if (event.target == modal) { 
       modal.style.display = "none"; 
      } 
     } 
     </script> 

     </head> 
     <body onkeydown="ESCclose(event)"> 

     <button onclick="document.getElementById('id01').style.display='block'" class="m3">Login</button> 

     <div id="id01" class="modal"> 
     <?php echo validation_errors(); ?> 

     <?php echo form_open('verify1', 'class="modal-content animate"');?> 

      <div class="imgcontainer"> 
      <span onclick="document.getElementById('id01').style.display='none'" class="close" title="Close Modal">&times;</span> 

      </div> 

      <div class="container"> 

     <center> 
      <h1 > Login</h1> 
      </center> 
      <label><b>Email id</b></label> 
      <input type="text" placeholder="Enter Email id" name="email" required> 

      <label><b>Password</b></label> 
      <input type="password" placeholder="Enter Password" name="password" required> 

      <button class="but" type="submit" name="submit" value="Submit">Login</button> 
      <br> 
      <input type="checkbox" checked="checked"> 
      Remember me 
      </div> 

      <div class="container" style="background-color:#f1f1f1"> 
      <span align = "left"><a href="<?php echo site_url('Test/') ?>">Forgot Password?</a></span> 
      <span align = "right"> New User? - <a href="#" onclick="document.getElementById('id03').style.display='block';document.getElementById('id01').style.display='none';"> Register Now</a> 
      </span> 
      </div> 
     </form> 
     </div> 



     <div id="id03" class="modal"> 
     <?php echo validation_errors(); ?> 


     <form role="form" name="signup" method="post" class="modal-content animate" action="<?php echo site_url('verify2');?>" > 

      <div class="imgcontainer"> 
      <span onclick="document.getElementById('id03').style.display='none'" class="close" title="Close Modal">&times;</span> 

      </div> 

      <div class="container"> 
      <center> 
      <h1 > Sign Up</h1> 
      </center> 
      <label><b>Name</b> 
      <input type="text" placeholder="Enter your full name" name="name" id ="name" maxlength="40" required> 
      </label> 

      <label><b>Email id</b></label> 
      <input type="text" placeholder="Email id" pattern="[a-z0-9._%+-][email protected][a-z0-9.-]+\.[a-z]{2,3}$" name="email" id ="email" maxlength="70" required> 
      <label><b>Mobile No</b></label> 
      <input type="text" placeholder="Mobile No." pattern="[7-9]{1}[0-9]{9}" maxlength="10" name="mob" required> 

      <label><b>Password</b></label> 
      <input type="password" placeholder="Enter minimum 6 digit Password" pattern=".{6,}" name="password" id="password" required> 
      <label><b>Confirm Password</b> 
      <input type="password" placeholder="Confirm your Password" pattern=".{6,}" name="repassword" id="repassword" required> 
      </label> 

      <button class="but" type="submit" name="submit" id = "submit" value="submit"> Submit</button> 

      <div class="container" style="background-color:#f1f1f1"> 
      Already registerd - <a href="#" onclick="document.getElementById('id01').style.display='block';document.getElementById('id03').style.display='none';"> Login</a> 
      </div> 
      <?php echo form_close();?> 


      </div> 
     </form> 
     </div> 




     </body> 

    </html> 
+1

申し訳ありません後、私はStackOverflowのに新たなんです。私は自分のコードをアップロードして、それを通過してください。 –

+1

@JYoThI私はIDが一意であると思う、それは1つのパスワードと別のもののための再パスワードだ –

+0

あなたのコンソールのエラーは何ですか? – JYoThI

答えて

1

しようとすると、フォーム

+0

実際には、私はそれだけをしていたし、それは動作していなかったので、私はそれが私がこれを好きだった理由ですスクリプトが頭の中の体の前にあるはずですが、それはまだ動作していません。 –

+0

password.onchange = validatePassword; password.onchange = validatePassword(); – subodhkalika

+0

nope:/、それでもうまくいかなかった –

関連する問題