Programmazione:Java/Javascript per il controllo del tasto MAIUSC
<script language="JavaScript" src="js/jscapslock.js"></script>
<script type="text/javascript">
function showHide(layerid){
if (document.getElementById(layerid).style.visibility != "hidden"){
document.getElementById(layerid).style.visibility = "hidden"
}
else{
document.getElementById(layerid).style.visibility = "visible"
}
}
</script>
onkeypress="capsDetect(event);"
Ocio!
Maiusc attivo
<button style="width:74;height:20;font-size:10;border:1px outset #ffffff;" onclick="showHide('box2')">Ok</button>
js/jscapslock.js":
function capsDetect( e ) {
if( !e ) { e = window.event; }
if( !e ) { MWJ_say_Caps( false );
return;
}
//premuto il maiusc
var theKey = e.which ? e.which : ( e.keyCode ? e.keyCode : ( e.charCode ? e.charCode : 0 ) );
//premuto il tasto shift
var theShift = e.shiftKey || ( e.modifiers && ( e.modifiers & 4 ) ); //AND
//se maiusc, guarda che non sia premuto lo shife. Se non maiusc, guarda che sia premuto
MWJ_say_Caps( ( theKey > 64 && theKey < 91 && !theShift ) || ( theKey > 96 && theKey < 123 && theShift ) );
}
function MWJ_say_Caps( oC ) {
if( typeof( capsError ) == 'string' ) {
if( oC ) { showHide('box2'); }
} else { capsError( oC ); }
}
function showHide(layerid){
if (document.getElementById(layerid).style.visibility != "hidden"){
document.getElementById(layerid).style.visibility = "hidden"
}
else{
document.getElementById(layerid).style.visibility = "visible"
}
}