=========================================================
<script language="javascript">
function get_sum(){
var sum = 0
var a,b,c
a = document.getElementById('jl1').value>0?document.getElementById('jl1').value:0
b = document.getElementById('jl2').value>0?document.getElementById('jl2').value:0
c = document.getElementById('jl3').value>0?document.getElementById('jl3').value:0
sum = parseFloat(a) + parseFloat(b) + parseFloat(c)
document.getElementById('result').innerHTML = sum
}
</script>
html
==========================================================
<p>
金额1
<input type="text" id="jl1">
</p>
<p>金额2
<input type="text" id="jl2">
</p>
<p>金额3
<input type="text" id="jl3">
</p>
<p>
<input type="button" value="求和" onClick="get_sum()"><span id="result"></span>
</p>
ps
===========================================================
如果是自动求和,则去掉button,在text加上事件 onKeyUp="get_sum()"
This is a completed finance app with Swift 3 And Nodejs.
The purpose i write it is i'm try to be a fullstack developer.
The ScreenShot as below
GitHub
Swift 3 + Realm + RxSwift + Alamofire
The project use Carthage as packmanager, please execute 'carthage update' before run
The project use npm &&MongoDB, please make sure you install it all before run
email: funpig@hotmail.com
QQ: 550462 (pls comments: github)
CNode
MIT