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

174
Visualizações
result calculated by Javascript function and displayed in another textbox ->does not instantly come up when I open the web page

I created 3 Javascript functions to perform calculations and show result in 3 textboxes , When I save this page and reopen it ->it does not pull the calculated values in respective text boxes unless I move my mouse over them or click on them. I have used window.onload method with the intention that it will run the function as the page opens. I am using onKeyUp and onMouseMove event Listeners , maybe that is the cause of the issue. If so, which event listener should I use to perform the operation.

<div class="form-group">
                @Html.Label("Admin Fee(5% of Total Amount of FNLCP Funding Used) ", htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                  
                    @Html.TextBox("AdminFeeWorkPlan", "", "{0:c}", new { @class = "form-control", id = "calculateAdminFee", @onKeyUp = "findTotal", @onMouseMove = "findTotal()" })
                    <script type="text/javascript">

                        function AdminFeee() {
                            var pullValue = document.getElementById('res').value || "0";

                            var output = (5/100) * parseFloat(pullValue);

                            if (!isNaN(output)) {
                                document.getElementById('calculateAdminFee').value = output;

                            }
                        }
                        window.onload = AdminFeee();

                    </script>

                </div>
            </div>
<div class="form-group">
       @Html.Label("Total ", htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                   
 @Html.TextBox("FinalTotal", "", "{0:c}", new { @readonly="readonly", @class = "form-control", id = "calculateTotal" })
                    <script type="text/javascript">

                       function findTotal() {
                            var one = document.getElementById('res').value || "0";
                           
                            var two = document.getElementById('calculateAdminFee').value || "0";
                            var output2 =  parseFloat(one)-parseFloat(two) ;

                            if (!isNaN(output2)) {
                                document.getElementById('calculateTotal').value = output2;
                            }
                        }
                        window.onload = findTotal();

                    </script>
                </div>
            </div>
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