Results 1 to 1 of 1
  1. #1
    VON!'s Avatar
    Join Date
    Oct 2014
    Gender
    male
    Posts
    87
    Reputation
    10
    Thanks
    28
    My Mood
    Lurking

    Unhappy I need help with an activity.

    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.
     


Similar Threads

  1. [Help Request] Need Help With A.V.A Error
    By ch1025 in forum Alliance of Valiant Arms (AVA) Help
    Replies: 7
    Last Post: 05-14-2011, 09:15 AM
  2. [Help Request] Need help with making binds !
    By JonathanTBM in forum Vindictus Help
    Replies: 4
    Last Post: 05-10-2011, 07:40 PM
  3. [Help Request] Need help with numpad while recording macro !
    By JonathanTBM in forum Vindictus Help
    Replies: 2
    Last Post: 05-10-2011, 07:37 PM
  4. [Help Request] need help with mod
    By .:MUS1CFR34K:. in forum Call of Duty Modern Warfare 2 GSC Modding Help/Discussion
    Replies: 4
    Last Post: 05-01-2011, 12:40 PM
  5. [Help Request] need help with modding
    By BayBee Alyn in forum Combat Arms Help
    Replies: 0
    Last Post: 04-27-2011, 09:06 PM