183
rated 0 times
[
185]
[
2]
/ answers: 1 / hits: 27526
/ 8 Years ago, mon, december 19, 2016, 12:00:00
i am practicing java script code but having issue while implementing this code.
<html>
<body>
<script>
function f2(){
var a=document.getElementById(a);
var b=document.getElementById(b);
var c=a+b;
document.write(c);
}
</script>
Enter A:<input id=a type=text name=txt1 ><br>
Enter B:<input id=b type=text name=txt2 ><br>
<button type=button onclick=f2()>Sum Here</button>
</body>
</html>
When I add two numbers then it shows error like [object HTMLInputElement][object HTMLInputElement].
More From » html