-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddscript.js
More file actions
27 lines (27 loc) · 741 Bytes
/
addscript.js
File metadata and controls
27 lines (27 loc) · 741 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*<!DOCTYPE html>
<html>
<body onmouseover="myFunction()">
<p>Compute : <label style="color:red;"><b>x+y=z</b></label></p>
<form>
x:<input type="text" id="x" value="0"onmouseout="myFunction()">
y:<input type="text" id="y" value="0"onmouseout="myFunction()">
</form>
<p id="demo"style="color:red;"></p>
<p>Sum=z, z=<span id="z">0</span></p>
*/
<script>
function myFunction() {
var x,y;
var add=function(x,y){return x+y;}
x=parseFloat(document.getElementById("x").value,0);
y=parseFloat(document.getElementById("y").value,0);
var z=add(x,y);
var s=[x," "+y," "+z];
document.getElementById("demo").innerHTML ="(x, y, z) : "+"("+s+")";
document.getElementById("z").innerHTML =z;
}
</script>
/*
</body>
</html>
*/