Q:

Javascript Password Submit - Form

I am trying to set a password to a form. I basically want someone to type a password into a password field and hit submit and if the password is right, it redirects them to buybutton.php in the same window. If the password isn't right, a javascript alert pops up that says 'Password wrong'. I've tried to write out the Javascript but no action is happening when the button is clicked. What have I done wrong in my code below? Thanks for the help!
<!DOCTYPE html>
<body width="950" height="300" style="background-image:url('giftcard_bg.jpg');">
<head>
<SCRIPT LANGUAGE="JavaScript">
    function goForit() {
      var passwd;
      passwd = this.document.giftForm.pass.value;
      if(passwd=="samsamsam"){
      window.open ('buybutton.php','_self',false)
      }
      else{
      alert('Password wrong');
      }
    }
</SCRIPT>
</head>

<div style="position:absolute; top:150px; left:285px; text-align:center;">
    <form id="giftForm">        
        <input type="password" id="pass" placeholder="Enter Secret Code" style="font-size:150%;"/>
        <br />
        <input type="button" onClick="goForit()" value="Submit" style="font-size:150%; margin-top:15px;" />                 
     </form>
</div>

</body>
</html>

A:

passwd = this.document.giftForm.pass.value; 

causes an error try 
passwd = document.getElementById('pass').value;

You were missing a ; too after window.open ('buybutton.php','_self',false)

