neil9999
04-20-2004, 07:32 PM
Hi,
I came up with this script while answering a question. Enter the right sequence to be directed to the right site. Sequence can be any length, any number of buttons can be added.
<html>
<head>
<script type ="text/javaScript">
var n=0;
var c=true;
//On the next line, enter order in which buttons must be clicked.
var a=["but1","but3","but4","but3"]
function check(w){
if(w!=a[n]){
c=false;
}
n++
if(n==a.length && c){
alert("Correct!");
window.location="http://www.google.co.uk";
}
else if(n==a.length){
alert("Wrong!")
n=0;
c=true;
}
}
</script>
</head>
<body>
<button id = "foo1" onClick ="check('but1')">
1
</button>
<button id = "foo2" onClick ="check('but2')">
2
</button>
<button id = "foo3" onClick="check('but3')">
3
</button>
<button id = "foo4" onClick="check('but4')">
4
</button>
</body>
</html>
Bear in mind this is not secure, view the source code to view the password, so for fun only.
Neil
I came up with this script while answering a question. Enter the right sequence to be directed to the right site. Sequence can be any length, any number of buttons can be added.
<html>
<head>
<script type ="text/javaScript">
var n=0;
var c=true;
//On the next line, enter order in which buttons must be clicked.
var a=["but1","but3","but4","but3"]
function check(w){
if(w!=a[n]){
c=false;
}
n++
if(n==a.length && c){
alert("Correct!");
window.location="http://www.google.co.uk";
}
else if(n==a.length){
alert("Wrong!")
n=0;
c=true;
}
}
</script>
</head>
<body>
<button id = "foo1" onClick ="check('but1')">
1
</button>
<button id = "foo2" onClick ="check('but2')">
2
</button>
<button id = "foo3" onClick="check('but3')">
3
</button>
<button id = "foo4" onClick="check('but4')">
4
</button>
</body>
</html>
Bear in mind this is not secure, view the source code to view the password, so for fun only.
Neil