javascript - Can't get html to check value -


i having webpage value of textbox , check value of "bypass". if stuff in textbox equals value of "bypass", website redirect google. doesn't work, if put in correct values.

my code this:

<!doctype html>    <head>      <title>aca2</title>    </head>        <body>  <center>    <form>      <p><input type="password" name="pass"><br></p>      <p><button onclick="bypasscheck()">...</button></p>    </form>      <p><a href="index.html">back</a></p>  </center>    <script type="text/javascript">  function bypasscheck() {    var aaa = document.getelementbyname('pass')[0].value    var bbb = "bypass";    if(aaa == bbb) {      window.location.assign("www.google.com")    }  }  </script>    </body>    </html>

use document.getelementsbyname , window.open("https://www.google.co.in/") proper https url. if provide www.google.co.in won't redirected google.

below working code:

  <!doctype html>       <head>         <title>aca2</title>       </head>    <body>     <center>       <form>         <p><input type="password" name="pass"><br></p>         <p><button onclick="bypasscheck()">...</button></p>       </form>         <p><a href="index.html">back</a></p>     </center>      <script type="text/javascript">     function bypasscheck() {      var aaa = document.getelementsbyname('pass')[0].value       var bbb = "bypass";       if(aaa == bbb) {         window.open("https://www.google.co.in/")       }     }     </script>      </body>      </html> 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -