PDA

View Full Version : Open link in same window


tom4stir
10-19-2002, 07:14 PM
With this html from http://www.javascriptkit.com/:

<SCRIPT>
function passWord() {
var testV = 1;
var pass1 = prompt('Please Enter Your Password',' ');
while (testV < 3) {
if (!pass1)
history.go(-1);
if (pass1.toLowerCase() == "letmein") {
alert('You Got it Right!');
window.open('protectpage.html');
break;
}
testV+=1;
var pass1 =
prompt('Access Denied - Password Incorrect, Please Try Again.','Password');
}
if (pass1.toLowerCase()!="password" & testV ==3)
history.go(-1);
return " ";
}
</SCRIPT>
<CENTER>
<FORM>
<input type="button" value="Enter Protected Area" onClick="passWord()">
</FORM>
</CENTER>
__________________________________________________
The link opend in a seperate window on my site. Is there any way I can get it to open it the same window?

Galdo
10-19-2002, 07:23 PM
<SCRIPT>
function passWord() {
var testV = 1;
var pass1 = prompt('Please Enter Your Password',' ');
while (testV < 3) {
if (!pass1)
history.go(-1);
if (pass1.toLowerCase() == "letmein") {
alert('You Got it Right!');
window.location('protectpage.html');
break;
}
testV+=1;
var pass1 =
prompt('Access Denied - Password Incorrect, Please Try Again.','Password');
}
if (pass1.toLowerCase()!="password" & testV ==3)
history.go(-1);
return " ";
}
</SCRIPT>
<CENTER>
<FORM>
<input type="button" value="Enter Protected Area" onClick="passWord()">
</FORM>
</CENTER>


Try that.

tom4stir
10-19-2002, 07:31 PM
I tryed that, and after I entered the password, it didn't do anything. :(

Thanks anyway.

tom4stir
10-19-2002, 08:29 PM
Does anyone have any other ideas?

Simrey
10-19-2002, 08:47 PM
How about

window.location="protectpage.html"

Simon

tom4stir
10-19-2002, 08:58 PM
Thank you very much :) !

It worked! :D