PDA

View Full Version : _blank



grumpyted1
03-17-2011, 07:14 AM
I hope i'm posting on the correct forum. Please forgive if not..

I use a very simple script to act as a basic password protection. It's not in need of anything more secure.

But how do i get the page called to load in a new window _blank ?

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
function Login(){
var done=0;
var username=document.login.username.value;
username=username.toLowerCase();
var password=document.login.password.value;
password=password.toLowerCase();
if (username=="user" && password=="pass") { window.location="./directoy/index.htm"; done=1; }

if (done==0) { alert("Invalid login!"); }
}
// End -->
</SCRIPT>

Called by:
<td>Username:</td>
<td><input type=text name=username></td>
</tr>
<tr>
<td>Password:</td>
<td><input type=text name=password></td>
</tr>
<tr>
<td colspan=2 align=center><input name="button" type=button onClick="Login()" value="Login!"></td>

Help! :o)

Nile
03-17-2011, 11:53 AM
Use window.open() instead of window.location