Home Redirect to another page in same folder using javascript
Reply: 0

Redirect to another page in same folder using javascript

user1893 Published in May 23, 2018, 4:49 pm

I'm working on a change password page. In this page the user enters the new password and confirms the new password. If both the passwords are not matching it should be in the same page. If the passwords match, then the user gets directed to another page. I have tried all methods to redirect the page , but it is not happening. Please help !

function f1()
        var newpass = document.getElementById('npass').value;
        var confirmpass = document.getElementById('cpass').value;

            document.getElementById('npass').value = "";
            document.getElementById('cpass').value = "";
            alert("Password Mismatch. Please enter again!");

           //window.location.href = "/file.html";
           // window.location = 'file.html';
           // window.location.replace('file.html');
            //window.location.href = "file.html";
            alert("Password Match");

         //   window.location.href= "/file.html";

        // document.write("check");



<form method="POST" onsubmit="f1()">

<label for="npass">New Password:</label>
<input type="password" id="npass" placeholder="Enter New Password" 
name="newpassword" required="required" size="8">

<label for="cpass">Confirm Password:</label>
<input type="password" id="cpass" placeholder="Confirm New Password" 
name="cpass" required="required" size="8"><br><br>
<input type="submit" class="btn btn-info" name="submit" value="Submit">

The alert boxes are working but the page redirect is not happening. I have tried all the redirect methods as shown in the code. But still not working. New to javascript. Please help

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.363631 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO