SHARE
TWEET

Untitled

a guest Jun 19th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <div class="form-group" id="formvalor">
  2.   <label class="control-label col-md-3 col-sm-3 col-xs-12">Valor <small>(R$) </small><span class="required">*</span></label>
  3.   <div class="col-md-3 col-sm-3 col-xs-12" id="valor_total">
  4.     <input type="text" class="form-control col-md-7 col-xs-12 decimal" name="valor" id="valor" value="10" readonly><br>
  5.   </div>
  6. </div>
  7.  
  8. <div class="form-group">
  9.   <label class="control-label col-md-3 col-sm-3 col-xs-12">Entrada <small>(R$) </small><span class="required">*</span></label>
  10.   <div class="col-md-3 col-sm-3 col-xs-12" id="valEntrada">
  11.     <input type="text" class="form-control col-md-7 col-xs-12 decimal" name="entrada" id="entrada" value="0"><br>
  12.   </div>
  13. </div>
  14.  
  15. <div class="form-group">
  16.   <label class="control-label col-md-3 col-sm-3 col-xs-12">Saldo <small>(R$) </small><span class="required">*</span></label>
  17.   <div class="col-md-3 col-sm-3 col-xs-12" id="saldo_total">
  18.     <input type="text" class="form-control col-md-7 col-xs-12 decimal" name="saldo" id="saldo" value="" readonly>
  19.   </div>
  20. </div>
  21.      
  22. $("#entrada").change(function(){
  23.   $.post("saldo_total.php",
  24.   {entrada:''+$("#entrada").val()+'', valor:''+$("#valor").val()+''},
  25.   function(valor){
  26.     $("#saldo").html(valor);
  27.   });
  28. });
  29.      
  30. $("#entrada").change(function(){
  31.     $.post("saldo_total.php",
  32.     {entrada:''+$("#entrada").val()+'', valor:''+$("#valor").val()+''},
  33.         function(valor){
  34.             $("#saldo").val(valor);
  35.         });
  36. });
  37.      
  38. Array( [entrada]=>50 [valor]=>undefined )
  39.      
  40. <input type="text" class="form-control col-md-7 col-xs-12 decimal" name="entrada" id="entrada" value="0" onchange="MUDAVALOR(this.id)">
  41.      
  42. <script>
  43. function MUDAVALOR(id) {
  44.     var entrada = document.getElementById(id).value;
  45.     var valor = document.getElementById('valor').value;
  46.     entrada = entrada.replace(/./g,'');
  47.     entrada = entrada.replace(',','.');
  48.     entrada = new Number(entrada);
  49.     valor = valor.replace(/./g,'');
  50.     valor = valor.replace(',','.');
  51.     valor = new Number(valor);  
  52.     var total = valor + entrada;
  53.     total = total.toFixed(2);
  54.     document.getElementById('saldo').value = total;
  55. }
  56.  
  57. </script>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top