129
rated 0 times
[
136]
[
7]
/ answers: 1 / hits: 24338
/ 12 Years ago, fri, january 4, 2013, 12:00:00
I'm trying to display form results on the same page as the form but when I click my Get Total button I see the result appear briefly then disappear. My result is off too, I'm trying to add my variables together but I'm getting a join instead.
<form id=percentageBiz method=post>
<input type=text id=sum1>
<input type=text id=sum2>
<input type=submit onclick=total() value=Get Total>
<div id=display style=height: 50px; width: 100%;></div>
<script>
function total(){
var a = document.forms[percentageBiz][sum1].value;
var b = document.forms[percentageBiz][sum2].value;
//alert(a+b)
var display=document.getElementById(display)
display.innerHTML=a+b;
}
</script>
More From » javascript