You are on page 1of 3

9. Create a form for Employee information.

Write JavaScript code to


find DA, HRA, PF, TAX, Gross pay, Deduction and Net pay.
<html>
<head>
<title>EMPLOYEE INFORMATION</title>
<script>
function findSalary()
{
var empname=document.frmEmp.ename.value;
var edept=document.frmEm p.dept.value;
var basicpay=parseInt(document.frm Emp.basic.value);
var da, hra,tax,pf,grosspay, deductions, netpay:
da = basicpay * 0.5;
hra = basicpay * 0.15;
grosspay = basicpay + da + hra;
pf = grO sspay * 0.12;
tax = grosspay 0.1;
deductions =pf + tax;
deductions;
netpay = grosspay
SALARY DETAILS </h1><br
document. write("<h1> EMPLOYEE : <b>". />cbr />");
document. writeln("EmployeeName
document. writeln ("Basic Pay <b>"4
+empname+"</b><br/s"):/>");
cb>"+basicpay+"</b><br
document. writeln ("Dearness Allowance : '+da+"</b><br />");
document. writeln("House Rent Allowance: <b>"+hra+"</b><br />");
document. writeln ("Gross Salary : <b>"+grosspay+"</b><br />"):;
document.writeln("Deductions
document. writeln("Net Salary
:cb>"+deductions+"</b><br
: <b>"+netpay+"</b>");
/>");
}
</script>
</head>
<body bgcolor="lightgrey" >
<form name="frm Emp">
<center><b><h1>EMPLOYEE SALARY DETAILS</h1></b></center><br/>cbr/s
<h2>Enter Employee Name, Department and Basic Pay</h2>
<pre>
<font size="4">
<center> <hl>EMPLOYEE SALARY DETAILS </h1><center>
EMPLOYEE NAME <input type="text"
name="ename"><br/>
DEPARTMENT <input type="text" name="dept"><br/><br/>
BASIC PAY <input type="text" name="basic"><br/><br/>
</font>
</pre>
<input type="button" value="Calculate Net Salary" oncL ="findSalary();">
</body>
</html>
Output:
EMPLOYEE SALARY DETALS
Enter Employee name and Basic pay

EMPLOYEE SALARY DETAILS


MPLONTK NAM
CompUer Science

3000U
LAB MANUAL 30

EMPLOYEE SALARY DETAILS


Employee Name : Anand B.
Basic Pay:30000
Dearness Allowance:15000
House Rent Alowance: 4500
Gross Salary :49500
Deduchioas : 10890
Net Salary:38610

You might also like