[JAVASCRIPT] - Problema scambio immagini [mod]
Allora, io ho preso questo pezzetto di testo in javascript da modificare ma ho vari problemi:
<SCRIPT LANGUAGE="JavaScript"><!--
var abilitato=0;
var strin="";
function test(){
//Fino a qui capisco. Analizza se il browser e' compatibile con Javascript.
browserName=navigator.appName.charAt(0);
browserVer=parseInt(navigator.appVersion);
if (browserName=="M" && browserVer >= 3) abilitato=1;
if (browserName=="N" && browserVer >= 3) abilitato=2;
if (browserName=="N" && browserVer >= 4) abilitato=3;
if (browserName=="M" && browserVer >= 4) abilitato=4;
}
function keyDown(e) {
if (abilitato==3) {
//Anche qui, tutto a posto perché questo IF non mi serve.
var nKey=e.which; var ieKey=0;
var realkey = String.fromCharCode(e.which);
strin="Codice tasto in Netscape: "+nKey+". Premuto tasto "+realkey
}
if (abilitato==4) {
//Qui c'è il problema. :???: Io vorrei che la variabile iekey (cioè il codice del tasto premuto sulla tastiera) o la variabile realkey (cioè la lettera del tasto premuto sulla tastiera) facessero in modo che, ad un particolare tasto premuto, attivassero una particolare funzione.
var ieKey=event.keyCode; var nKey=0;
var realkey = String.fromCharCode(event.keyCode);
strin="Codice tasto in Explorer: " + ieKey+". Premuto tasto "+realkey
}
alert(strin)
}
document.onkeydown = keyDown
//--></SCRIPT>
Ringrazio chiunque abbia il buon cuore di aiutarmi.