I'm currently studying html & javascript
but im still lack of knowledge about it.
the output should be the same as image below.
My current .html file
[SPOILER]
<html>
<head>
<script>
function meme(){
var name = document.getElementById("name").value;
var rate = document.getElementById("rate").value;
var hours = document.getElementById("hours").value;
var gross = hours * rate;
var sss = gross * .10;
var tax = gross * .25;
document.write("<table border="1">");
document.write("<tr><td>...</td><td>...</td></tr>");
document.write("</table>");
}
</script>
</head>
<h1>Employee Statistics</h1>
<body>
<form name="lememe">
<table border="1">
<tr><td colspan="2" >Employee Infomation</td></tr>
<tr><td>Name</td><td><input type="text" id="name"</td></tr>
<tr><td>Hour</td><td><input type="text" id="hours"</td></tr>
<tr><td>Rate</td><td><input type="text" id="rate"</td></tr>
</table>
<input type="Button" value="Compute" onclick="meme()">
</form>
</body>
</html>
[/SPOILER]
Fixed
[spoiler]<html>
<head>
<script>
function meme(){
var name = document.getElementById("name").value;
var rate = document.getElementById("rate").value;
var hours = document.getElementById("hours").value;
var gross = hours * rate;
var sss = gross * .10;
var tax = gross * .25;
var total = sss + tax;
var net = total - gross;
document.write('<h1>Payslip</h1>');
document.write('Name:'+name+' ');
document.write('<table border="1" witdh="20%" height="20%">');
document.write('<tr><td>Gross</td><td>Deduction</td><td>Netpay</td></tr>');
document.write('<tr><td rowspan="5"> ' +gross+ ' </td><td>SSS: '+sss+'</td><td rowspan="5"> '+net+' </td><tr>');
document.write('<tr><td>Tax: '+tax+'</td><tr>');
document.write('<tr><td>Total: '+total+' </td><tr>');
document.write('</table>');
}
</script>
</head>
<h1>Payroll Infomation</h1>
<body>
<form name="lememe">
<table border="1" width="30%">
<tr><td colspan="2">Employee Infomation</td></tr>
<tr><td>Name</td><td><input type="text" id="name" size="45%"</td></tr>
<tr><td>Hour</td><td><input type="text" id="hours"</td></tr>
<tr><td>Rate</td><td><input type="text" id="rate"</td></tr>
</table>
<input type="Button" value="Compute" onclick="meme()">
</form>
</body>
</html>[/spoiler]
Last edited by VON!; 10-11-2017 at 08:03 AM. Reason: I fixed it by myself.