sessomy
06-30-2003, 02:38 AM
Hi
I'm really new to js programming, so forgive me if this is basic.
I wanted to put a password gate on a page and have found this one:
To go in head section:
<script language="JavaScript">
function PasswordLogin()
{
document.location.href = document.formlogin.password.value + ".htm";
return false;
}
function CheckEnter(event)
{
var NS4 = (document.layers) ? true : false;
var code = 0;
if (NS4)
code = event.which;
else
code = event.keyCode;
if (code==13)
{
PasswordLogin();
event.returnValue = false;
}
}
</script>
To go in body:
<form name="formlogin" onsubmit="PasswordLogin()">
Password: <input type="password" name="password" size="20" onKeyPress="CheckEnter(event)">
<input type="button" value="Login" onclick="PasswordLogin()"></p>
</form>
My question is can anyone tell me how to change this code so that the passworded page opens in a new window!!!?
Its the first time I've tryed the script...... does anyone know of any better ones???
Thanks
Stuart
I'm really new to js programming, so forgive me if this is basic.
I wanted to put a password gate on a page and have found this one:
To go in head section:
<script language="JavaScript">
function PasswordLogin()
{
document.location.href = document.formlogin.password.value + ".htm";
return false;
}
function CheckEnter(event)
{
var NS4 = (document.layers) ? true : false;
var code = 0;
if (NS4)
code = event.which;
else
code = event.keyCode;
if (code==13)
{
PasswordLogin();
event.returnValue = false;
}
}
</script>
To go in body:
<form name="formlogin" onsubmit="PasswordLogin()">
Password: <input type="password" name="password" size="20" onKeyPress="CheckEnter(event)">
<input type="button" value="Login" onclick="PasswordLogin()"></p>
</form>
My question is can anyone tell me how to change this code so that the passworded page opens in a new window!!!?
Its the first time I've tryed the script...... does anyone know of any better ones???
Thanks
Stuart