a little problem

S

Sander de Maaijer

hello
i hav a little problem this is a script calles secret word when you type the
secret word you get a alert whit the text:"and this is the text of the alert
wehn you know the word"
butt i want not a alert but a forwarding to a other site can anybody help
me ?
and sorry my english is NOT good

thnx sander

<html>

<head>
<title>secret word</title>
<script language="JavaScript">
var nav=navigator.appName;
var ns=(nav.indexOf("Netscape")!=-1);

if(ns){
if(document.layers){
document.captureEvents(Event.KEYPRESS);
document.onkeypress = cheat;
}
if(document.getElementById){
document.onkeypress = cheat;
}
}
else
{document.onkeypress = cheat;}

var SpecialWord = "secret";//thist is the secret word
var SpecialLetter = 0;
var vcheat = false
function cheat(keyStroke)
{
var eventChooser = (ns)?keyStroke.which: event.keyCode;
var which = String.fromCharCode(eventChooser).toLowerCase();
if(which == SpecialWord.charAt(SpecialLetter)){
SpecialLetter++;
if (SpecialLetter == SpecialWord.length) alert("and this is the text of
the alert when you know the word")
}
else {SpecialLetter = 0;vcheat = false}

}
</script>
</head>

<body>
</body>

</html>
 
S

Stuart Palmer

try doing a document.location="url_to_new_site"; instead of the alert.

I would suggest that JS password validation is useless too as if a browser
can read the password, a user can also get the password by viwing source,
there are pasword encoders, but also decoders for these passwords. Best to
do the validation serverside.

Anyways, hope that helps

Stu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top