Java Script error when browse the mozilla, uncaught error()

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • svsenthilkumar
    New Member
    • Dec 2007
    • 11

    Java Script error when browse the mozilla, uncaught error()

    hai ,

    i got an error in javascript, when upload a file in a form,

    the code is working properly in IE but i got javascript error in Mozilla firefos
    what is mean by error and how to rectify that.

    the error is
    Error: uncaught exception: [Exception... "Security error" code: "1000" nsresult: "0x805303e8 (NS_ERROR_DOM_S ECURITY_ERR)" location: form1.php


    here is the code
    =============== =

    [HTML]<script language="javas cript">

    function checkform()

    {
    varfile = document.form1. file1.value;
    if(varfile == "")
    {
    alert("Select a file to upload");
    document.form1. file1.focus();
    return false;
    }

    if(varfile!="")
    {

    varfile = document.form1. file1.value;
    valfoc=document .form1.file1;
    valofch=validof file(varfile,va lfoc)
    if(valofch==fal se)
    {
    valfoc.focus();
    return false;
    }
    }
    varfile2= document.form1. file2.value;
    if(varfile2!="" )
    {
    varfile2 = document.form1. file2.value;
    valfoc2=documen t.form1.file2;
    valofch2=valido ffile(varfile2, valfoc2)
    if(valofch2==fa lse)
    {
    valfoc2.focus() ;
    return false;
    }
    }
    }

    function validoffile(val ofchk,valfoc)
    {

    var Valu=valofchk;
    var Val=Valu.toLowe rCase();
    var Val1=Val.indexO f('.pdf');
    var Val2=Val.indexO f('.zip');

    if (Val1==-1 && Val2==-1 )
    {
    alert('You can attach only any of .pdf, .zipextension file');
    return (false);
    }
    }
    function imposeMaxLength (Object, MaxLen)
    {
    return (Object.value.l ength < MaxLen);
    }
    function fnPaste(vEl)
    {
    var intMaxLength, intCurrLength, strClip ;
    var intClipLength, intAvailLength ;
    var blnReturn ;

    blnReturn = true ;
    intMaxLength = vEl.getAttribut e("maxlength" ) ;
    intCurrLength = vEl.value.lengt h ;
    strClip = window.clipboar dData.getData(" Text") ;
    intClipLength = strClip.length ;
    intAvailLength = intMaxLength - intCurrLength ;

    if (intAvailLength > 0)
    {
    if (intAvailLength < intClipLength)
    {
    strClip = strClip.substr( 0, intAvailLength) ;
    window.clipboar dData.setData(" Text",strClip) ;
    }
    }
    else
    {
    blnReturn = false ;
    }
    return blnReturn ;
    //filesave.php
    }
    </script>

    <form name="form1" action="#" method="post" enctype="multip art/form-data" onsubmit="retur n checkform()">

    <table>
    <tr bgcolor="#f6f4f 4">
    <td><div class="body" align="right">F ile 1</div></td>
    <td><input name="file1" id="file1" class="textfiel dbig" type="file" unselectable="o n">
    *</td>
    </tr>
    <tr bgcolor="#f6f4f 4">
    <td><div class="body" align="right">D escription For File 1</div></td>
    <td><textarea class="messageb ox" id="textarea1" name="desfile1" onkeypress="ret urn imposeMaxLength (this, 1500);" onpaste="return fnPaste(this);" maxlength=1500 ></textarea></td>
    </tr>
    <tr bgcolor="#f6f4f 4">
    <td><div class="body" align="right">F ile 2</div></td>
    <td><input name="file2" class="textfiel dbig" type="file" unselectable="o n"></td>
    </tr>
    <tr bgcolor="#f6f4f 4">
    <td><div class="body" align="right">D escription For File 2</div></td>
    <td><textarea class="messageb ox" id="textarea1" name="desfile2" onkeypress="ret urn imposeMaxLength (this, 1500);" onpaste="return fnPaste(this);" maxlength=1500 ></textarea></td>
    </tr>
    </table>[/HTML]
    Last edited by gits; Mar 3 '08, 08:55 AM. Reason: added code tags
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    What line does it occur on?

    Comment

    • svsenthilkumar
      New Member
      • Dec 2007
      • 11

      #3
      Originally posted by acoder
      What line does it occur on?

      Error: uncaught exception: [Exception... "Security error" code: "1000" nsresult: "0x805303e8 (NS_ERROR_DOM_S ECURITY_ERR)" location: "form123.ph p Line: 110"]

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Originally posted by svsenthilkumar
        Error: uncaught exception: [Exception... "Security error" code: "1000" nsresult: "0x805303e8 (NS_ERROR_DOM_S ECURITY_ERR)" location: "form123.ph p Line: 110"]
        Which line would that be in your code?

        Comment

        Working...