Extrange error Why?

M

Miguel Cañedo

Hi:
I'm testing with fireforx 1.0 on MdkLinux10.0
I can not figure out why am I getting this error:


Error: [Exception... "'Permiso denegado para obtener propiedad
XULElement.selectedIndex' when calling method:
[nsIAutoCompletePopup::selectedIndex]" nsresult: "0x8057001e
(NS_ERROR_XPC_JS_THREW_STRING)" location: "JS frame ::
file:///home/mcanedo/Desktop/forma.html :: validar :: line 151" data: no]
Archivo Fuente: file:///home/mcanedo/Desktop/forma.html
Línea: 151



This is the code I'm working on:


<html>
<head><TITLE></TITLE>
<STYLE type="text/css">
body{background:gray;color:yellow;}
input{border-color:transparent}
..cEtiqueta{background:black;color:yellow;font-weight:bold;
border-width:1px;text-align:right;font-family:sans-serif;}
..cEditable{background:white;color:black;font-weight:bold;;border-width:1px;text-align:right;font-family:sans-serif;}
..cTitulo{background:white;color:black;font-weight:bold;border-width:1px;text-align:center;font-family:sans-serif;}
..cCodigo{background:white;color:black;font-weight:bold;border-width:1px;text-align:left;font-family:sans-serif;}
..cCantidad{background:white;color:black;font-weight:bold;border-color:transparent;border-width:1px;text-align:right;width:20pxfont-family:sans-serif;}
..cDescripcion{background:black;color:yellow;font-weight:bold;
border-width:1px;text-align:left;font-family:sans-serif;}
..cEspecial{background:white;color:red;font-weight:bold;border-width:1px;text-align:right;font-family:sans-serif;}
..cTotal
{background:white;color:red;font-weight:bold;font-size:large;border-width:1px;text-align:right;font-family:sans-serif;}
</STYLE>
<script type="text/javascript">

var vRenglones=10;

var vCodigo =new
Array(null,"FER-315","FER-330","ACM-BL","FER-CHAM","ACM-PAN","ARE-5","VSI-PAN","VSI-CHA","ALGO-COM");
var vDescripcion = new Array(null,"Fergino Mezclilla","Fergino
Gabardina","Blusa ACM","Chamarra
Fergino","ACM-PAN","ARE-5","VSI-PAN","VSI-CHA","ALGO-COM");
var vPrecio = new Array(null,315.00,330.00,270.00,420.00,200,100,50,120,136)
var vPromocion = new
Array(null,300.00,null,250.00,null,190,90,40,null,null,null)

//variables para num2txt
var numbers = new
Array('','un','dos','tres','cuatro','cinco','seis','siete','ocho','nueve','diez','once','doce','trece','catorce','quince','dieciseis','diecisiete','dieciocho','diecinueve','veinte','veinun','veintidos','veintires','veinticuatro','veinticinco','veintiseis','veintisiete','veintiocho','veintinueve');
var numbers10 = new
Array('','diez','veinte','treinta','cuarenta','cincuenta','sesenta','setenta','ochenta','noventa');

function num2txt(input,texto) {
//El valor maximo es 99,000

var dollars = Math.floor(input);
var cents = Math.round((input*100 - dollars*100));

if (cents<10){
cents='0'+cents;
}

var thousands = (dollars - dollars % 1000) / 1000;
dollars -= thousands * 1000;
var hundreds = (dollars - dollars % 100) / 100;
dollars -= hundreds * 100;

var output = '';

output += (thousands > 0 ? fN(thousands) + ' mil ' : '');

switch (hundreds){
case 1:
if(dollars==0){
output += 'cien ';
}else{
output += 'ciento ';
}
break;
case 5: output += 'quinientos ';
break;
case 7: output += 'setecientos ';
break;
case 9: output += 'novecientos ';
break;
default:
output += (hundreds > 0 ? fN(hundreds) + 'cientos ' : '');
}

output += (dollars > 0 ? fN(dollars) + ' ' : '') +
((thousands > 0 || hundreds > 0 || dollars > 0) ? texto+' ' : '') +
cents + '/100';

return output.substring(0,1).toUpperCase() + output.substring(1);
}

//llamada desde num2txt
function fN(i) {
if (i<30) return numbers;
var tens = (i - i % 10) / 10, units = i - (i - i % 10);
return numbers10[tens] + ((tens > 0 && units > 0) ? ' y ' : '') +
numbers[units];
}

//formato numerico
function numerico(n) {
n=n*1;
var arr=new Array('0'), i=0;
while (n>0)
{arr=''+n%1000; n=Math.floor(n/1000); i++;}
arr=arr.reverse();
for (var i in arr) if (i>0) //padding zeros
while (arr.length<3) arr='0'+arr;
return arr.join();
}


//actualiza el renglon con el valor selecionadp
/*
function compute(form, select, indice){
var vfDes='fDes_'+indice;
var vfPrecio='fPrecio_'+indice;
var vfCantidad='fCantidad_'+indice;
var vfPromocion='fPromocion_'+indice;
var vfCodigo='fCodigo_'+indice;

document.getElementById(vfCantidad).value=1;

document.getElementById(vfDes).innerHTML=vDescripcion[select.selectedIndex];
document.getElementById(vfPrecio).innerHTML=vPrecio[select.selectedIndex];

document.getElementById(vfPromocion).value=vPromocion[select.selectedIndex];


calcularRenglon(form,indice);
//se cambaia el foco excepto en el ultimo renglon
if(indice+1<vRenglones){
var vSigIndice=(indice*1)+1;
var vFCodigoSigIndice='fCodigo_'+vSigIndice;
var vFCantidadSigIndice='fCantidad_'+vSigIndice;
var vFPromocionSigIndice='fPromocion_'+vSigIndice;
document.getElementById(vFCodigoSigIndice).disabled=false;
document.getElementById(vFCantidadSigIndice).disabled=false;
document.getElementById(vFPromocionSigIndice).disabled=false;
document.getElementById(vFCodigoSigIndice).focus(); //verificar la ultima
y mandar al boton
}

}
*/

//actualiza el renglon con el valor selecionadp
function validar(indice){
var i;
var vfDes='fDes_'+indice;
var vfPrecio='fPrecio_'+indice;
var vfCantidad='fCantidad_'+indice;
var vfPromocion='fPromocion_'+indice;
var vfCodigo='fCodigo_'+indice;

for (i=0;i<vCodigo.length;i++){
if(document.getElementById(vfCodigo).value.toUpperCase()==vCodigo){
// SI EXISTE
document.getElementById(vfCantidad).value=1;
document.getElementById(vfDes).innerHTML=vDescripcion;
document.getElementById(vfPrecio).innerHTML=vPrecio;
document.getElementById(vfPromocion).value=vPromocion;

calcularRenglon(indice);
//se cambaia el foco excepto en el ultimo renglon
if(indice+1<vRenglones){
var vSigIndice=(indice*1)+1;
vSigIndice=vSigIndice+'';
var vFCodigoSigIndice='fCodigo_'+vSigIndice;
var vFCantidadSigIndice='fCantidad_'+vSigIndice;
var vFPromocionSigIndice='fPromocion_'+vSigIndice;
document.getElementById(vFCodigoSigIndice).disabled=false;
document.getElementById(vFCantidadSigIndice).disabled=false;
document.getElementById(vFPromocionSigIndice).disabled=false;
document.getElementById(vFCodigoSigIndice).focus();
}
}
}
}


//calcula el monto del renglon indice de la forma form y el Total
function calcularRenglon(indice){
var vTotal=0;
var vfMonto='fMonto_'+indice;
var vfPrecio='fPrecio_'+indice;
var vfCantidad='fCantidad_'+indice;
var vfPromocion='fPromocion_'+indice;
if(document.getElementById(vfPromocion).value==""){
//precio regular

document.getElementById(vfMonto).innerHTML=document.getElementById(vfCantidad).value*document.getElementById(vfPrecio).innerHTML;
}else{
//precio promocion

document.getElementById(vfMonto).innerHTML=document.getElementById(vfCantidad).value*document.getElementById(vfPromocion).value;
}

//Aqui se calcula el total
for (ren=0;ren<vRenglones;ren++){
var vfMontoI='fMonto_'+ren;
if (typeof document.getElementById(vfMontoI).innerHTML != "undefined"){
vTotal=vTotal+(document.getElementById(vfMontoI).innerHTML*1); //*1 para
que tome como numero
}
}
document.getElementById('fTotal').innerHTML=numerico(vTotal*1);
document.getElementById('fTxtTotal').innerHTML=num2txt(vTotal,'pesos');
}


</script>


</head>

<body>
<table>
<form name=fVentas method="get">
<tr>
<TD class="cTitulo">Codigo</TD>
<td class="cTitulo">Cantidad</td>
<td class="cTitulo">Descripcion</td>
<td class="cTitulo">Precio</td>
<td class="cTitulo">Especial</td>
<td class="cTitulo">Monto</td>
</tr>

<script type="text/javascript">
//escribe tal cantidad de renglones
for (i=0;i<vRenglones;i++){
//se habilita solo el primer renglon
if (i>0){
vDeshabilita='disabled';
}else{
vDeshabilita='';
}

//esto es todo un renglon de la tabla
document.write("<tr>");
document.write("<td class=\"cCodigo\"><input "+vDeshabilita+" type=\"text\"
class=\"cCodigo\" name=\"fCodigo_"+i+"\" id=\"fCodigo_"+i+"\"
onChange=\"validar("+i+")\" ></td>");
document.write("<td class=\"cCantidad\"><input "+vDeshabilita+"
type=\"text\" class=\"cCantidad\" name=\"fCantidad_"+i+"\"
id=\"fCantidad_"+i+"\" onChange=\"calcularRenglon("+i+")\" ></td>");
document.write("<td class=\"cDescripcion\" name=\"fDes_"+i+"\"
id=\"fDes_"+i+"\"></td>");
document.write("<td class=\"cEtiqueta\" name=\"fPrecio_"+i+"\"
id=\"fPrecio_"+i+"\" ></td>");
document.write("<td class=\"cEspecial\"><input "+vDeshabilita+"
type=\"text\" class=\"cEspecial\" name=\"fPromocion_"+i+"\"
id=\"fPromocion_"+i+"\" onChange=\"calcularRenglon("+i+")\" ></td>");
document.write("<td class=\"cEtiqueta\" name=\"fMonto_"+i+"\"
id=\"fMonto_"+i+"\" ></td>");
document.write("<tr>");
document.write("</tr>");
}

</script>



<tr><TD>
</TD><td>
</td><TD>
</TD><TD>
</TD><TD>Total</TD>
<TD class="cTotal" name="fTotal" id="fTotal"></TD></tr>


<tr><TD colspan=6 align=right name="fTxtTotal" id="fTxtTotal"
class="cTotal" ></TD></tr>
</table>

<tr><TD><input type="button" value="Vender" onclick="submit()"></TD></tr>

</form>


</body>
</html>
 
M

Miguel Cañedo

Miguel said:
Hi:
I'm testing with fireforx 1.0 on MdkLinux10.0
I can not figure out why am I getting this error:


Error: [Exception... "'Permiso denegado para obtener propiedad
XULElement.selectedIndex' when calling method:
[nsIAutoCompletePopup::selectedIndex]" nsresult: "0x8057001e
(NS_ERROR_XPC_JS_THREW_STRING)" location: "JS frame ::
file:///home/mcanedo/Desktop/forma.html :: validar :: line 151" data: no]
Archivo Fuente: file:///home/mcanedo/Desktop/forma.html
Línea: 151

To replicate error type FER-330 in the first cell.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top