jsは入力の値の変化をリアルタイムで監視し、値が変化すると自動的に別の入力を計算して入力します

<table style="border-collapse:separate; border-spacing:0px 10px;">
 <tr>
  <td align="right">应收现金:</td>
  <td><input id="accountReceivable" autoComplete='off'></td>
  <td>元,折扣:</td>
  <td><input id="vipdiscount"  ></td>
  <td align="right">实收:</td>
  <td><input id="receipts" readonly="true"></td>
  <td>元 </td>
  <td>消费类型:<select id="conType"><option value="1" >报名费</option><option value="2" >酒水零食费</option></select></td>
  <td><a id="btnSend" class="easyui-linkbutton">提交</a></td>
									   
 </tr>
</table>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
	<script type="text/javascript">
$(function(){  
 
	$('#accountReceivable').bind('input propertychange', function() {  
		var a = $('#accountReceivable').val();
		var b = $('#vipdiscount').val();
		var sum= a * b;
		
	    $('#receipts').val(sum);  
	}); 
  
}) 
</script>

入力値の変化をリアルタイムで監視し、計算します

<input type="text" id="borrowValue">
	<span id="repayValue">0</span>
 <input type="text" id="repayValue"  >
 
	<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
	<script type="text/javascript">
		$('#borrowValue').bind('input propertychange', function() {
			var loadInterest = '4';
	  		var borrowValue = $(this).val();
	  		var repayValue = loadInterest*30*borrowValue/10000;
			$("#repayValue").html(repayValue);
		});
	</script>

おすすめ

転載: blog.csdn.net/lc547913923/article/details/88542132