Exercise #4 interactive
</head>
<body>
<h1>Determine Salary and Tax </h1>
<p>Enter your details : </p>
<fieldset>
<label>Enter your name </label>
<input type="text" onfocus="this.value=''" name="fname" id="fname" value="" /> <br>
<label>Enter your salary </label>
<input type="number" onfocus="this.value=''" name="salary" id="salary" value="" /> <br>
<input type=button onclick="display()" name="display" id="display" value="display"> </button>
</fieldset>
<p id=“demo”>
<input type=“number” id=“salary” value=“ ” name=“fname” />></p>
<p id="demo2"></p>
<style>
margin-bottom: 10px;
}
label {
display: inline-block;
width: 200px;
}
fieldset {
background: #A3C1AD;
}
legend {
padding: 20px 0;
font-size: 20px;
}
p{
display: inline-block;
width: 1000px;
}
<script>
fname=document.getElementById("fname").value;
salary=document.getElementById("salary").value;
document.getElementById("demo").innerHTML = "Name " + fname + "<br> Grade :" +salary;
If(salary >=45001 )
{
tax = salary *0.20 ;
remarks = ‘<style color:“blue” ; font-size:40px; > Tax 20% : ‘ + tax;
}
else if (salary >=35001)
{
tax= salary * 0.15;
remarks = ‘ <style color:“green” ; font-size:40px; > Tax 15% : ‘ +tax;
}
else if (salary >=25001)
{
tax= salary * 0.10;
remaks = ‘<style color:violet ; font-size:40px; > Tax 10% : ‘ + tax ;
}
else
remarks = "<style color:violet ; font-size:40px; > Tax Exempted: ‘ + tax ;
document.getElementById("demo2").innerHTML= "<br> Remarks :" +remarks;
}
</body>
</html>
No comments:
Post a Comment