lcg #005
the calculator in jsFiddle
by dirkk0
HTML
<p>
<input type="text" id="i1"></input>
<input type="text" id="i2"></input>
<button id="b1" onClick="doCalc()">Add!</button>
</p>
<p id="r"></p>
CSS
html{
background-color:lightgrey;
}
JavaScript
doCalc = function () {
var n1 = document.getElementById('i1').value
n1 = parseFloat(n1)
var n2 = document.getElementById('i2').value
n2 = parseFloat(n2)
var r = n1 + n2;
console.log(r);
document.getElementById('r').innerHTML = r
}