Vi prego di predonarmi se vi scasso le...... ma io ed il javascript siamo nemici giurati....
questo scriptino lo presi (ed in parte modificai) dagli esempi di Html.
sostanzialmente fa la somma di 4 addendi e redirige alla pagina corrispondente..
-------
<head>
<script type="text/javascript" language="JavaScript">
<!--
// You may use this script freely as long
// as you credit me for it...
var usermulcode=24
// This is to validate the code. In this case
// the code is 1234 so the mul = 1*2*3*4 = 24
// Change this value for your own code
// If your code is 2415 it will be
// usermulcode = 40 (2*4*1*5)
var code=0 // the entered code
var mul=1 // the multiplied digits
var digit=0 // number of digits entered so far
var fails=0 // number of tries done
function Enter_code(number)
{
code=code*10+number // Add the digit to the code
// code=code+"number"
mul=mul*number // Update mul-value
document.codepad.thecode.value=code // Show code
digit++ // Increase digit
if (digit==4) // Four digits entered
{
if (mul==24) // This is to validate
// the code. In this case
// the code is 1234 so the
// mul = 1*2*3*4 = 24
// Change this value for
// your own code
{
location=code+".htm"
}
else
{
fails++ // Increase fails
code=0 // Reset values
mul=1
digit=0
if (fails<3)
{
if (fails==1)
{document.codepad.thecode.value="riprova"}
if (fails==2)
{document.codepad.thecode.value="ultima volta"}
}
else // To many tries = worp back
{
location="java.htm"
document.codepad.thecode.value="A presto!"
}
}
}
}
// Key-code script by Bart Jellema -->
//-->
</script>
</head>
<body >
<div align="center">
<FORM name=codepad>
<INPUT onclick=Enter_code(1) type=button value=" 1 ">
<INPUT onclick=Enter_code(2) type=button value=" 2 ">
<INPUT onclick=Enter_code(3) type=button value=" 3 ">
<INPUT onclick=Enter_code(4) type=button value=" 4 ">
<INPUT onclick=Enter_code(5) type=button value=" 5 ">
<INPUT onclick=Enter_code(6) type=button value=" 6 ">
<INPUT onclick=Enter_code(7) type=button value=" 7 ">
<INPUT onclick=Enter_code(8) type=button value=" 8 ">
<INPUT onclick=Enter_code(9) type=button value=" 9 ">
<INPUT size=10 value="" name=thecode>
</FORM>
</body>
</html>
-------
quello che interessa fare è un po' complicato.. e per quello ho bisogno fdi aiuto..
1) fare in modo che lo script non rediriga lla pagina //
// your own code
{
location=code+".htm"
ma che il form a index.php passando la variabile CODE
2) fare in modo che la password possa accettare anche delle LETTERE ovvero non avvenga l'operazione di moltiplicazione ma semplicemente un concatenamento di caratteri (cosi' da usare anche lo "0".
grazie per le dritte che mi potete dare.
Flavio