Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

81
Visualizações
Get a result for tolerance m7

can somebody help me to solve this problem? I'm trying to get a difference between a lower tolerance and an upper tolerance. I've found a site that gives me the .js calculation for the upper and lower tolerance, it also gives me the maximum and minimum diameter, but I also want to get the diference between those results. I've tried to find all over internet but failed at finding something. Here is the link to the code and .js files that i'm using.

https://jsfiddle.net/my974Ljh/1/

I have another code iqual to this one, with one more script. But this script gives me the result I want but I have to insert manualy the inputs.

<script type="text/javascript">
    function id(el) {
        return document.getElementById( el );
        }
    function total( un, diamx ) {
        return parseFloat(un.replace(',', '.'), 10) - parseFloat(diamx.replace(',', '.'), 10);
        }
    window.onload = function() {
        id('diamn').addEventListener('keyup', function() {
        var result = total( this.value , id('diamx').value );
        id('total').value = String(result.toFixed(3)).formatMoney();
        });

        id('diamx').addEventListener('keyup', function(){
        var result = total( id('diamn').value , this.value );
        id('total').value = String(result.toFixed(3)).formatMoney();
        });
        }

    String.prototype.formatMoney = function() {
        var v = this;

        if(v.indexOf('.') === -1) {
        v = v.replace(/([\d]+)/, "$1,00");
        }

        v = v.replace(/([\d]+)\.([\d]{1})$/, "$1,$200");
        v = v.replace(/([\d]+)\.([\d]{2})$/, "$1,$2");
        v = v.replace(/([\d]+)([\d]{3}),([\d]{2})$/, "$1.$2,$3");

        return v;
        };
    </script>

Hope you can help me with this one. I know that I can simplify the code but I'm trying to solve one problem at a time.

Thank you so much.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda