Also keep in mind that the javascript solution is considered bad design since some people may have javascript turned off, resulting in a lost sale and no money.
If you're looking for a simple solution, have the script generates an exact copy of the html page you want users to get to after the correct password is given. Not ideal, but simple.