Extrange error Why?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Miguel Cañedo

    Extrange error Why?

    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.sele ctedIndex' when calling method:
    [nsIAutoComplete Popup::selected Index]" nsresult: "0x8057001e
    (NS_ERROR_XPC_J S_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:yel low;}
    input{border-color:transpare nt}
    ..cEtiqueta{bac kground:black;c olor:yellow;fon t-weight:bold;
    border-width:1px;text-align:right;fon t-family:sans-serif;}
    ..cEditable{bac kground:white;c olor:black;font-weight:bold;;bo rder-width:1px;text-align:right;fon t-family:sans-serif;}
    ..cTitulo{backg round:white;col or:black;font-weight:bold;bor der-width:1px;text-align:center;fo nt-family:sans-serif;}
    ..cCodigo{backg round:white;col or:black;font-weight:bold;bor der-width:1px;text-align:left;font-family:sans-serif;}
    ..cCantidad{bac kground:white;c olor:black;font-weight:bold;bor der-color:transpare nt;border-width:1px;text-align:right;wid th:20pxfont-family:sans-serif;}
    ..cDescripcion{ background:blac k;color:yellow; font-weight:bold;
    border-width:1px;text-align:left;font-family:sans-serif;}
    ..cEspecial{bac kground:white;c olor:red;font-weight:bold;bor der-width:1px;text-align:right;fon t-family:sans-serif;}
    ..cTotal
    {background:whi te;color:red;fo nt-weight:bold;fon t-size:large;bord er-width:1px;text-align:right;fon t-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,"Fer gino Mezclilla","Fer gino
    Gabardina","Blu sa ACM","Chamarra
    Fergino","ACM-PAN","ARE-5","VSI-PAN","VSI-CHA","ALGO-COM");
    var vPrecio = new Array(null,315. 00,330.00,270.0 0,420.00,200,10 0,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','cu atro','cinco',' seis','siete',' ocho','nueve',' diez','once','d oce','trece','c atorce','quince ','dieciseis',' diecisiete','di eciocho','dieci nueve','veinte' ,'veinun','vein tidos','veintir es','veinticuat ro','veinticinc o','veintiseis' ,'veintisiete', 'veintiocho','v eintinueve');
    var numbers10 = new
    Array('','diez' ,'veinte','trei nta','cuarenta' ,'cincuenta','s esenta','setent a','ochenta','n oventa');

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

    var dollars = Math.floor(inpu t);
    var cents = Math.round((inp ut*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.substrin g(0,1).toUpperC ase() + output.substrin g(1);
    }

    //llamada desde num2txt
    function fN(i) {
    if (i<30) return numbers[i];
    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[i]=''+n%1000; n=Math.floor(n/1000); i++;}
    arr=arr.reverse ();
    for (var i in arr) if (i>0) //padding zeros
    while (arr[i].length<3) arr[i]='0'+arr[i];
    return arr.join();
    }


    //actualiza el renglon con el valor selecionadp
    /*
    function compute(form, select, indice){
    var vfDes='fDes_'+i ndice;
    var vfPrecio='fPrec io_'+indice;
    var vfCantidad='fCa ntidad_'+indice ;
    var vfPromocion='fP romocion_'+indi ce;
    var vfCodigo='fCodi go_'+indice;

    document.getEle mentById(vfCant idad).value=1;

    document.getEle mentById(vfDes) .innerHTML=vDes cripcion[select.selected Index];
    document.getEle mentById(vfPrec io).innerHTML=v Precio[select.selected Index];

    document.getEle mentById(vfProm ocion).value=vP romocion[select.selected Index];


    calcularRenglon (form,indice);
    //se cambaia el foco excepto en el ultimo renglon
    if(indice+1<vRe nglones){
    var vSigIndice=(ind ice*1)+1;
    var vFCodigoSigIndi ce='fCodigo_'+v SigIndice;
    var vFCantidadSigIn dice='fCantidad _'+vSigIndice;
    var vFPromocionSigI ndice='fPromoci on_'+vSigIndice ;
    document.getEle mentById(vFCodi goSigIndice).di sabled=false;
    document.getEle mentById(vFCant idadSigIndice). disabled=false;
    document.getEle mentById(vFProm ocionSigIndice) .disabled=false ;
    document.getEle mentById(vFCodi goSigIndice).fo cus(); //verificar la ultima
    y mandar al boton
    }

    }
    */

    //actualiza el renglon con el valor selecionadp
    function validar(indice) {
    var i;
    var vfDes='fDes_'+i ndice;
    var vfPrecio='fPrec io_'+indice;
    var vfCantidad='fCa ntidad_'+indice ;
    var vfPromocion='fP romocion_'+indi ce;
    var vfCodigo='fCodi go_'+indice;

    for (i=0;i<vCodigo. length;i++){
    if(document.get ElementById(vfC odigo).value.to UpperCase()==vC odigo[i]){
    // SI EXISTE
    document.getEle mentById(vfCant idad).value=1;
    document.getEle mentById(vfDes) .innerHTML=vDes cripcion[i];
    document.getEle mentById(vfPrec io).innerHTML=v Precio[i];
    document.getEle mentById(vfProm ocion).value=vP romocion[i];

    calcularRenglon (indice);
    //se cambaia el foco excepto en el ultimo renglon
    if(indice+1<vRe nglones){
    var vSigIndice=(ind ice*1)+1;
    vSigIndice=vSig Indice+'';
    var vFCodigoSigIndi ce='fCodigo_'+v SigIndice;
    var vFCantidadSigIn dice='fCantidad _'+vSigIndice;
    var vFPromocionSigI ndice='fPromoci on_'+vSigIndice ;
    document.getEle mentById(vFCodi goSigIndice).di sabled=false;
    document.getEle mentById(vFCant idadSigIndice). disabled=false;
    document.getEle mentById(vFProm ocionSigIndice) .disabled=false ;
    document.getEle mentById(vFCodi goSigIndice).fo cus();
    }
    }
    }
    }


    //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='fPrec io_'+indice;
    var vfCantidad='fCa ntidad_'+indice ;
    var vfPromocion='fP romocion_'+indi ce;
    if(document.get ElementById(vfP romocion).value ==""){
    //precio regular

    document.getEle mentById(vfMont o).innerHTML=do cument.getEleme ntById(vfCantid ad).value*docum ent.getElementB yId(vfPrecio).i nnerHTML;
    }else{
    //precio promocion

    document.getEle mentById(vfMont o).innerHTML=do cument.getEleme ntById(vfCantid ad).value*docum ent.getElementB yId(vfPromocion ).value;
    }

    //Aqui se calcula el total
    for (ren=0;ren<vRen glones;ren++){
    var vfMontoI='fMont o_'+ren;
    if (typeof document.getEle mentById(vfMont oI).innerHTML != "undefined" ){
    vTotal=vTotal+( document.getEle mentById(vfMont oI).innerHTML*1 ); //*1 para
    que tome como numero
    }
    }
    document.getEle mentById('fTota l').innerHTML=n umerico(vTotal* 1);
    document.getEle mentById('fTxtT otal').innerHTM L=num2txt(vTota l,'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<vRenglon es;i++){
    //se habilita solo el primer renglon
    if (i>0){
    vDeshabilita='d isabled';
    }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=\"vali dar("+i+")\" ></td>");
    document.write( "<td class=\"cCantid ad\"><input "+vDeshabilita+ "
    type=\"text\" class=\"cCantid ad\" name=\"fCantida d_"+i+"\"
    id=\"fCantidad_ "+i+"\" onChange=\"calc ularRenglon("+i +")\" ></td>");
    document.write( "<td class=\"cDescri pcion\" name=\"fDes_"+i +"\"
    id=\"fDes_"+i+" \"></td>");
    document.write( "<td class=\"cEtique ta\" name=\"fPrecio_ "+i+"\"
    id=\"fPrecio_"+ i+"\" ></td>");
    document.write( "<td class=\"cEspeci al\"><input "+vDeshabilita+ "
    type=\"text\" class=\"cEspeci al\" name=\"fPromoci on_"+i+"\"
    id=\"fPromocion _"+i+"\" onChange=\"calc ularRenglon("+i +")\" ></td>");
    document.write( "<td class=\"cEtique ta\" 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><inpu t type="button" value="Vender" onclick="submit ()"></TD></tr>

    </form>


    </body>
    </html>
  • Miguel Cañedo

    #2
    Re: Extrange error Why?

    Miguel Cañedo wrote:
    [color=blue]
    > 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.sele ctedIndex' when calling method:
    > [nsIAutoComplete Popup::selected Index]" nsresult: "0x8057001e
    > (NS_ERROR_XPC_J S_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
    >[/color]

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

    Comment

    Working...