Onclick event; If and Else
        Posted  
        
            by 
                Kyle Gagnon
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Kyle Gagnon
        
        
        
        Published on 2012-12-08T16:14:52Z
        Indexed on 
            2012/12/08
            17:03 UTC
        
        
        Read the original article
        Hit count: 323
        
JavaScript
|html
All right so I am doing a javascript code for a login type form and it will lead you to a new page. Here it is:
function submit1()
{
    var x=document.getElementById("username");
    var y=document.getElementById("password");
    if (x.value=="username" && y.value=="password")
    {
        window.location="Example.php";
    }
    else
    {
        window.alert=("The information you have submitted is incorrect and needs to be submitted again!");
    }
}
When ever I am hitting the submit button it takes me straight to the page instead of checking to see if it right. Please help! Thank you in advanced! To let you know this is not a permanet login page!
© Stack Overflow or respective owner