Salve,
da alcuni giorni combatto con questo codice javascript che IE 6 si ostina a non eseguire.
var browser="ie";
var ctasto="";
function trovatastiera()
{
if (navigator.appName == "Netscape")browser="ns";
if (navigator.appName == "Microsoft Internet Explorer") browser="ie";
}
function keyDown(e)
{
if (browser=="ns") {
var nKey=e.which; //codice tasto
var ieKey=0;
var realkey = String.fromCharCode(e.which); //tasto premuto
}
if (browser=="ie") {
var ieKey=event.keyCode; //codice tasto
var nKey=0;
var realkey = String.fromCharCode(event.keyCode); //tasto premuto
}
if (browser=="ns")ctasto=nKey; else ctasto=ieKey;
switch(ctasto){
case 13: //invio
document.getElementById(id="editor").testo.value = document.getElementById(id="editor").testo.value+'<br />';
var targetCambiaCp = /<br \/>\n<br \/>/;
var verificaTarget = targetCambiaCp.test(document.getElementById(id="editor").testo.value = document.getElementById(id="editor").testo.value);
if (verificaTarget)
document.getElementById(id="editor").testo.value = document.getElementById(id="editor").testo.value.replace(/<br \/>\n<br \/>/, "\n</p>\n<p>");
break;
Qualcuno può darmi una mano?
Grazie
Michele
da alcuni giorni combatto con questo codice javascript che IE 6 si ostina a non eseguire.
var browser="ie";
var ctasto="";
function trovatastiera()
{
if (navigator.appName == "Netscape")browser="ns";
if (navigator.appName == "Microsoft Internet Explorer") browser="ie";
}
function keyDown(e)
{
if (browser=="ns") {
var nKey=e.which; //codice tasto
var ieKey=0;
var realkey = String.fromCharCode(e.which); //tasto premuto
}
if (browser=="ie") {
var ieKey=event.keyCode; //codice tasto
var nKey=0;
var realkey = String.fromCharCode(event.keyCode); //tasto premuto
}
if (browser=="ns")ctasto=nKey; else ctasto=ieKey;
switch(ctasto){
case 13: //invio
document.getElementById(id="editor").testo.value = document.getElementById(id="editor").testo.value+'<br />';
var targetCambiaCp = /<br \/>\n<br \/>/;
var verificaTarget = targetCambiaCp.test(document.getElementById(id="editor").testo.value = document.getElementById(id="editor").testo.value);
if (verificaTarget)
document.getElementById(id="editor").testo.value = document.getElementById(id="editor").testo.value.replace(/<br \/>\n<br \/>/, "\n</p>\n<p>");
break;
Qualcuno può darmi una mano?
Grazie
Michele