Que tal
Acabo de hacer unas funciones en javascript que funcionan correctamente en Internet explorer pero en Firefox no funciona les dejo el codigo ojala me puedan ayudar
<html>
<head>
<script LANGUAGE="JavaScript">
function delete_char(evt)
{
var charCode=evt.charCode ? evt.charCode : evt.keyCode;
var char=String.fromCharCode(charCode);
str_alterno = document.getElementById('hdnCardNumbrer').value;
if(document.getElementById('txtCardNumber').value. length < 1)
str_alterno = '';
else
{
var a_borrar= document.getElementById('hdnCardNumbrer').value.le ngth - document.getElementById('txtCardNumber').value.len gth;
str_alterno = str_alterno.substr(0,str_alterno.length-a_borrar);
}
document.getElementById('hdnCardNumbrer').value = str_alterno;
var tecla = window.event.keyCode;
}
function masking_control(evt)
{
if(document.getElementById('selCardType').value==' AMEXCO'){
document.getElementById('txtCardNumber').maxLength =15;
var charCode=evt.charCode ? evt.charCode : evt.keyCode;
var char=String.fromCharCode(charCode);
//if ( charCode == 8 || charCode == 46 )
//{
str_alterno = document.getElementById('hdnCardNumbrer').value;
if(document.getElementById('txtCardNumber').value. length < 1)
str_alterno = '';
else
{
var a_borrar= document.getElementById('hdnCardNumbrer').value.le ngth - document.getElementById('txtCardNumber').value.len gth;
str_alterno = str_alterno.substr(0,str_alterno.length-a_borrar);
}
document.getElementById('hdnCardNumbrer').value = str_alterno;
// return false;
//}else
//{
var control = document.getElementById('txtCardNumber');
var new_value = '';
for(var i=0; i<control.value.length;i++)
{
if(i<11)
new_value += '*';
else
new_value += control.value.charAt(i);
}
document.getElementById('txtCardNumber').value = new_value;
var str_aux = char;
if(str_alterno.length != 16)
str_alterno = str_alterno + str_aux;
document.getElementById('hdnCardNumbrer').value = str_alterno;
//}
}else{
document.getElementById('txtCardNumber').maxLength =16;
var charCode=evt.charCode ? evt.charCode : evt.keyCode;
var char=String.fromCharCode(charCode);
str_alterno = document.getElementById('hdnCardNumbrer').value;
if(document.getElementById('txtCardNumber').value. length < 1)
str_alterno = '';
else
{
var a_borrar= document.getElementById('hdnCardNumbrer').value.le ngth - document.getElementById('txtCardNumber').value.len gth;
str_alterno = str_alterno.substr(0,str_alterno.length-a_borrar);
}
document.getElementById('hdnCardNumbrer').value = str_alterno;
{
var control = document.getElementById('txtCardNumber');
var new_value = '';
for(var i=0; i<control.value.length;i++)
{
if(i<12)
new_value += '*';
else
new_value += control.value.charAt(i);
}
document.getElementById('txtCardNumber').value = new_value;
var str_aux = char;
if(str_alterno.length != 16)
str_alterno = str_alterno + str_aux;
document.getElementById('hdnCardNumbrer').value = str_alterno;
}
}
}
function PermiteNumeros()
{
var tecla = window.event.keyCode;
tecla = String.fromCharCode(tecla);
if(!((tecla >= "0") && (tecla <= "9")))
{
window.event.keyCode = 0;
}
}
</script>
</head>
<body>
<select id="selCardType" onclick="tipotarjeta();"
onchange="resumenGarantia(); muestraMsg(msgOptType, this);mapStatusValidSlide.put('formaPago',false)"
style="WIDTH: 200px;">
<option value="">
</option>
<option value="AMEXCO">
AMEXCO
</option>
<option value="OTRO">
OTRO
</option>
<input id="txtCardNumber" onkeypress="PermiteNumeros();masking_control(event );" onkeyup="delete_char(event);"
onchange="busq_limpiaMensaje(msgTxtCardNumber, this, 'number');mapStatusValidSlide.put('formaPago',fals e)"
size="17" maxlength="16" onpaste="return false" />
<input id="hdnCardNumbrer" type="text"/>
</body>
</html>