<html>
<head>
<title>TEST SPOSTAMENTO CURSORI SU CELLE DI TABELLA</title>
<script type="text/javascript" language="javascript" >
var R = 1, C = 1;
function SpostaUpDown(R, C, e) {
var code = e.keyCode ? e.keyCode : e.charCode
// alert("R="+R+" C="+C);
if (code == 38) { SetFocus(R - 1, C); }
// alert("Up");
if (code == 40) { SetFocus(R + 1, C); }
// alert("DN");
if (code == 13) {
// alert(code);
Invio(R, C, e);
}
// invio
}
function SetFocus(R, C){
if (R==0) {R=1};
if (R>3) {R=3};
//if (C==0 || C==7) {C=1};
if (C>6) {C=6};
// SalvaCursore( R, C);
document.getElementById("R"+R+"C"+C).focus();
document.getElementById("R"+R+"C"+C).select();
}
function Invio(R, C, e) {
var code = e.keyCode ? e.keyCode : e.charCode;
if (code == 13) {
//alert(code);
ElaboraDatiForm(R, C);
return true; ;
}
else {
return false;
}
}
function ElaboraDatiForm(R, C) {
alert("elaboro cella a RIGA=" + R + ", COL.=" + C);
}
function NumbersOnly(myfield, e, dec) {
var key;
var keychar;
if (window.event)
key = window.event.keyCode;
else if (e)
key = e.which;
else
return true;
keychar = String.fromCharCode(key);
// control keys
if ((key == null) || (key == 0) || (key == 8) || (key == 9) || (key == 13) || (key == 27))
return true;
// numbers
else if ((("0123456789,").indexOf(keychar) > -1))
return true;
// decimal point jump
else if (dec && (keychar == ".")) {
myfield.form.elements[dec].focus();
return true;
} else
return false;
}
function LettersOnly(myfield, e, dec) {
var key;
var keychar;
if (window.event)
key = window.event.keyCode;
else if (e)
key = e.which;
else
return true;
keychar = String.fromCharCode(key);
// control keys
if ((key == null) || (key == 0) || (key == 8) || (key == 9) || (key == 13) || (key == 27))
return true;
// numbers
else if ((("abcdefghilmnopqrstuvzwxyjkABCDEFGHILMNOPQRSTUV ZWXYK .,àèìòù&0123456789").indexOf(keychar) > -1))
return true;
else
return false;
}
</script>
<style type="text/css">
<!--
input.objAttivo:hover {
background-color: #3399FF;
color:#000000;
}
input.objAttivo:active {
background-color:#FFFFFF;
}
input.objAttivo1 {
background-color: #666666;
color:#FFFFFF;
text-align:center;
}
-->
</style></head>
</head>
<body>
<table>
<tr>
<td><input class="objAttivo" type=text id="R1C1" name="R1C1" onkeypress="return NumbersOnly(this, event)" value="" size="20" onKeyDown="SpostaUpDown(1 , 1, event)" onFocus="this.style.backgroundColor='#8AF4F4'" onBlur="this.style.backgroundColor='#ffffff'" /></td>
<td><input class="objAttivo" type=text id="R1C2" name="R1C2" onkeypress="return NumbersOnly(this, event)" value="" size="20" onKeyDown="SpostaUpDown(1 , 2, event)" onFocus="this.style.backgroundColor='#8AF4F4'" onBlur="this.style.backgroundColor='#ffffff'" /></td>
<td><input class="objAttivo" type=text id="R1C3" name="R1C3" onkeypress="return NumbersOnly(this, event)" value="" size="20" onKeyDown="SpostaUpDown(1 , 3, event)" onFocus="this.style.backgroundColor='#8AF4F4'" onBlur="this.style.backgroundColor='#ffffff'" /></td>
<td><input class="objAttivo" type=text id="R1C4" name="R1C4" onkeypress="return NumbersOnly(this, event)" value="" size="20" onKeyDown="SpostaUpDown(1 , 4, event)" onFocus="this.style.backgroundColor='#8AF4F4'" onBlur="this.style.backgroundColor='#ffffff'" /></td>
<td><input class="objAttivo" type=text id="R1C5" name="R1C5" onkeypress="return NumbersOnly(this, event)" value="" size="20" onKeyDown="SpostaUpDown(1 , 5, event)" onFocus="this.style.backgroundColor='#8AF4F4'" onBlur="this.style.backgroundColor='#ffffff'" /></td>
<td><input class="objAttivo" type=text id="R1C6" name="R1C6" onkeypress="return NumbersOnly(this, event)" value="" size="20" onKeyDown="SpostaUpDown(1 , 6, event)"onFocus="this.style.backgroundColor='#8AF4F 4'" onBlur="this.style.backgroundColor='#ffffff'" /></td>
</tr>
<tr>
<td><input class="objAttivo" type=text id="R2C1" name="R2C1" onkeypress="return LettersOnly(this, event)" value="" size="20" onKeyDown="SpostaUpDown(2 , 1, event)" onFocus="this.style.backgroundColor='#8AF4F4'" onBlur="this.style.backgroundColor='#ffffff'" /></td>
<td><input class="objAttivo" type=text id="R2C2" name="R2C2" onkeypress="return LettersOnly(this, event)" value="" size="20" onKeyDown="SpostaUpDown(2 , 2, event)" onFocus="this.style.backgroundColor='#8AF4F4'" onBlur="this.style.backgroundColor='#ffffff'" /></td>
<td><input class="objAttivo" type=text id="R2C3" name="R2C3" onkeypress="return LettersOnly(this, event)" value="" size="20" onKeyDown="SpostaUpDown(2 , 3, event)" onFocus="this.style.backgroundColor='#8AF4F4'" onBlur="this.style.backgroundColor='#ffffff'" /></td>
<td><input class="objAttivo" type=text id="R2C4" name="R2C4" onkeypress="return LettersOnly(this, event)" value="" size="20" onKeyDown="SpostaUpDown(2 , 4, event)" onFocus="this.style.backgroundColor='#8AF4F4'" onBlur="this.style.backgroundColor='#ffffff'" /></td>
<td><input class="objAttivo" type=text id="R2C5" name="R2C5" onkeypress="return LettersOnly(this, event)" value="" size="20" onKeyDown="SpostaUpDown(2 , 5, event)" onFocus="this.style.backgroundColor='#8AF4F4'" onBlur="this.style.backgroundColor='#ffffff'" /></td>
<td><input class="objAttivo" type=text id="R2C6" name="R2C6" onkeypress="return LettersOnly(this, event)" value="" size="20" onKeyDown="SpostaUpDown(2 , 6, event)" onFocus="this.style.backgroundColor='#8AF4F4'" onBlur="this.style.backgroundColor='#ffffff'" /></td>
</tr>
<tr>
<td><input class="objAttivo" type=text id="R3C1" name="R3C1" value="" size="20" onKeyDown="SpostaUpDown(3 , 1, event)" onFocus="this.style.backgroundColor='#8AF4F4'" onBlur="this.style.backgroundColor='#ffffff'" /></td>
<td><input class="objAttivo" type=text id="R3C2" name="R3C2" value="" size="20" onKeyDown="SpostaUpDown(3 , 2, event)" onFocus="this.style.backgroundColor='#8AF4F4'" onBlur="this.style.backgroundColor='#ffffff'" /></td>
<td><input class="objAttivo" type=text id="R3C3" name="R3C3" value="" size="20" onKeyDown="SpostaUpDown(3 , 3, event)" onFocus="this.style.backgroundColor='#8AF4F4'" onBlur="this.style.backgroundColor='#ffffff'" /></td>
<td><input class="objAttivo" type=text id="R3C4" name="R3C4" value="" size="20" onKeyDown="SpostaUpDown(3 , 4, event)" onFocus="this.style.backgroundColor='#8AF4F4'" onBlur="this.style.backgroundColor='#ffffff'" /></td>
<td><input class="objAttivo" type=text id="R3C5" name="R3C5" value="" size="20" onKeyDown="SpostaUpDown(3 , 5, event)" onFocus="this.style.backgroundColor='#8AF4F4'" onBlur="this.style.backgroundColor='#ffffff'" /></td>
<td><input class="objAttivo" type=text id="R3C6" name="R3C6" value="" size="20" onKeyDown="SpostaUpDown(3 , 6, event)" onFocus="this.style.backgroundColor='#8AF4F4'" onBlur="this.style.backgroundColor='#ffffff'" /></td>
</tr>
</table>
</body>
</html>