Web Technologies
Slip14
Q.1) Write a JavaScript program to read employee details and generate pay slip which will calculate netsalary of an employee. [Marks 30]
Solution
head.html
<html><head>
<script>
function sal()
{
var b=document.getElementById("bs").value;
var h=document.getElementById("hra").value;
var d=document.getElementById("da").value;
var netsalary;
netsalary=Number(b)+Number(h)+Number(d);
alert("netsalary="+netsalary);
}
</script>
</head>
<body>
<form method="post" name="payment">
<h1 align="center" background-color="red">payslip</h1>
<table border="1" align="center">
<tr>
<td>Name of emplyoee</td>
<td><input type="text" name="nm" id="nm"></td>
</tr>
<tr>
<td>department</td>
<td><input type="text" name="dept" id="dept"></td>
</tr>
<tr>
<td>desgnation</td>
<td><input type="text" name="des"></td>
</tr>
<tr>
<td>basic salary</td>
<td><input type="text" name="bs" id="bs"></td>
</tr>
<tr>
<td>HRA</td>
<td><input type="text" name="hra" id="hra"></td>
</tr>
<tr>
<td>DA</td>
<td><input type="text" name="da" id="da"></td>
</tr>
<tr>
<td></td>
<td><input type="button" value="submit" onclick=sal()></td>
</tr>
</table>
</form>
</body>
</html>
Tags:
Web Technologies