AviEzerzer

2.5wip

May 3rd, 2017
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5.14 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3.  
  4. <head>
  5.     <meta charset="utf-8">
  6.     <meta name="viewport" content="width=device-width, initial-scale=1">
  7.     <meta name="author" content="Avi.E.Koenig">
  8.     <title>Programming 101</title>
  9.     <link rel="icon" href="http://dev5.granot.com/aviproject/main/images/avip.ico">
  10.     <link href="https://v4-alpha.getbootstrap.com/dist/css/bootstrap.min.css" rel="stylesheet">
  11.     <link href="https://v4-alpha.getbootstrap.com/examples/cover/cover.css" rel="stylesheet">
  12.     <link href="calc.css" type="text/css" rel="stylesheet" />
  13.     <script type="text/javascript">
  14.         //outputs the bonus portion only after calc.(previous outputs the whole paycheck.)
  15.         function Calc() {
  16.             var salary = parseInt(document.getElementById("salary").value); //grabs value from form.
  17.             //parseInt=defines var as a number rather than string,needed in >7000 function.
  18.             var bonus = 0;
  19.             //variable needed to define and initialize bonus output.
  20.             if (salary < 5000) {
  21.                bonus = salary * 0.1; //+10% bonus
  22.            } else {
  23.                bonus = salary * 0.05; //+5% bonus
  24.            }
  25.            if ((salary + bonus) > 7000) {
  26.                 //cuts 2% off paycheck if exceeds 7k when bonus applied.
  27.                 var richtax = (salary + bonus);
  28.                 richtax *= 0.02;
  29.                 bonus -= richtax; //-2% tax off bonus from paycheck total
  30.             }
  31.             document.getElementById("bonus").value = bonus;
  32.  
  33.         }
  34.  
  35.         function KeyFilter(event) {
  36.             if (((event.keyCode > 47) && (event.keyCode < 58)) || ((event.keyCode > 95) && (event.keyCode < 106)) || (event.keyCode == 8) || (event.keyCode == 13)) {
  37.                if (event.keyCode == 13) {
  38.                    Calc(); //Call Calc function
  39.                 }
  40.  
  41.             } else {
  42.                 event.returnValue = false;
  43.                 alert("Please type numbers only.");
  44.  
  45.             }
  46.         }
  47.     </script>
  48. </head>
  49.  
  50. <body>
  51.  
  52.     <div class="container-fluid text-center">
  53.         <div class="row">
  54.             <div class="col-xs-1 col-sm-1 col-md-1 col-lg-0">
  55.             </div>
  56.             <div class="jumbotron vertical-center">
  57.                 <div class="col-xs-10 col-sm-10 col-md-8 col-lg-12 container">
  58.                     <div class="form-group">
  59.                         <h3 class="text-muted font-family-base font-size-base line-height-base">Bonus-o-tron</h3>
  60.                         <h5 class="text-muted font-family-base font-size-base line-height-base">Version (2.5)</h5>
  61.                         <label for="bonus" class="text-muted">Design by Avi.E.Koenig</label>
  62.                         <br>
  63.                         <label for="bonus" class="text-muted">Script by Stanislav Mestechkin</label>
  64.                         <hr class="style18">
  65.                         <label for="salary" class="text-muted">Salary</label>
  66.                         <div class="input-group">
  67.                             <span class="input-group-addon" id="basic-addon1">
  68.                         <p style="margin-bottom: 10px;font-size: 1.5em;"></p>
  69.                         </span>
  70.                             <input type="text" onkeydown="KeyFilter(window.event)" class="form-control" id="salary" placeholder="Type Salary Amount here" aria-describedby="basic-addon1">
  71.                         </div>
  72.                         <label for="bonus" class="text-muted">Bonus</label>
  73.                         <div class="input-group">
  74.                             <span class="input-group-addon">
  75.                         <p style="margin-bottom: 10px;font-size: 1.5em;"></p>
  76.                         </span>
  77.                             <input type="text" onkeydown="return false" class="form-control" id="bonus" placeholder="Bonus Amount">
  78.                             <div class="input-group-btn">
  79.                                 <button class="btn btn-success" onclick="Calc()">Calculate
  80.                             </button></div>
  81.                         </div>
  82.                         <br><br>
  83.                         <hr class="style18">
  84.                     </div>
  85.                 </div>
  86.             </div>
  87.             <div class="col-xs-1 col-sm-1 col-md-1 col-lg-0">
  88.             </div>
  89.         </div>
  90.     </div>
  91.     <!-- Bootstrap core JavaScript
  92.        ================================================== -->
  93.     <!-- Placed at the end of the document so the pages load faster -->
  94.     <script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
  95.     <script>
  96.         window.jQuery || document.write('<script src="../../assets/js/vendor/jquery.min.js"><\/script>')
  97.     </script>
  98.     <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
  99.     <script src="https://v4-alpha.getbootstrap.com/dist/js/bootstrap.min.js"></script>
  100.     <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
  101.     <script src="https://v4-alpha.getbootstrap.com/assets/js/ie10-viewport-bug-workaround.js"></script>
  102.  
  103. </body>
  104.  
  105. </html>
Advertisement
Add Comment
Please, Sign In to add comment