Firefox Compatibility

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nydiow
    New Member
    • Mar 2010
    • 2

    Firefox Compatibility

    Hi guys

    Im having problems with one of my JScripts to support Firefox (works fine in IE)

    So...

    Code:
    function submitItOrder( sForm,sOrder )
    {
        // Coloca o comando no hide
        if ( document.all )
        {
    	idForm = eval( "document.all." + sForm );
    	if ( sOrder != "" )
    	{
    	    idForm.cmd.value = "PgInicio";
    	    idForm.pag.value = 0;
    	    idForm.idOrder.value = sOrder;
    	    idForm.lintot.value = 0;
    	}
    	idForm.submit();
        }
        else if (  document.getElementById && !document.all )
    	alert( 'Navegador: Firefox' );
    }
    
    function submitItTRANF(sForm,sCmd,sPag,sOrder,sLintot )
    {
        // Coloca o comando no hide
        if ( document.all )
        {
    	idForm = eval( "document.all." + sForm );
    	if ( sCmd != "" )
    	{
    	    idForm.cmd.value     = sCmd;
    	    idForm.pag.value     = sPag;
    	    idForm.idOrder.value = sOrder;
    	    idForm.lintot.value  = sLintot;
    	}
    	idForm.submit();
        }
        else
    	alert( 'Referencia inválida: ' + sForm );
    }
    Help me plz? I know that i must use document.getEle mentById but i dont know how to use it properly...
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    recommendation #1: drop document.all
    recommendation #2: drop eval()
    recommendation #3: read a tutorial, document.getEle mentById() is, er, required basic knowledge

    Comment

    • nydiow
      New Member
      • Mar 2010
      • 2

      #3
      After read a little, i tried that...

      Code:
      function submitItOrder( sForm,sOrder )
      {
          // Coloca o comando no hide
          if ( document.getElementById )
          {
      	//idForm = eval( "document.all." + sForm );
      	if ( sOrder != "" )
      	{
      	    document.getElementById(cmd).value = "PgInicio";
      	    document.getElementById(pag).value = 0;
      	    document.getElementById(idOrder).value = sOrder;
      	    document.getElementById(lintot).value = 0;
      	}
      	document.getElementById.submit();
          }
          else if (  document.getElementById && !document.all )
      	alert( 'Navegador: Firefox' );
      }
      and didnt work

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        the variables cmd, pag, idOrder & lintot are all undefined, unless you set them somewhere else.

        Comment

        Working...