Skip to main content

Add two number in javascript html dhtml

 <!DOCTYPE html>

<html>

<head>

<title>Page Title</title>

</head>

<body>

<input type="text" id="a">

<br>

<input type="text" id="b">

<br>

<button onClick=fun() > Result</button>

<br>


<script type="text/javascript">

function fun()

{

var a1 =document.getElementById("a").value;

var b1 =document.getElementById("b").value;

alert(+a1 + +b1);

}

</script>

</body>

</html>





Comments

Popular posts from this blog

unix commands