Thursday, 28 May 2020

Salary.html


first.js

function calc()
            {
            //----------------Calculate Net Salary--------------

            var y=parseInt(document.forma.t3.value)
            var hra=parseInt(y*8/100)
            var da=parseInt(y*5/100)
            var ta=parseInt(y*3/100)
            var ns=parseInt(y+hra+da+ta)
            alert("Net salary:"+ns);
            }


salary.html


<html>
<head>

<link rel="stylesheet" type="text/css" href="style.css">
<script type="text/javascript" src="first.js"></script>
</head>

<body>

<center> Employee Details </center>
<table align="center">
<form action="#" name="forma">

<tr>
<td>Employee no: </td>
<td> <input type="text" name="n1" id="n1"> </td>
</tr>

<tr>
<td> Name: </td>
<td> <input type="text" name="t2" id="t2"> </td>
</tr>
<tr>
<td> Basic Salary: </td>
<td> <input type="text" name="t3" id="t3"> </td>
</tr>

<tr>
<td colspan="2">
<center> <input type="button" value="Net Salary" onclick="return vali();" ondblclick="return calc();"/><input type="button" value="Clear"> </center>
</td>

</tr>

</form>
</table>
</body>
</html>