Advertisement
Guest User

Untitled

a guest
Dec 13th, 2017
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.24 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>Assignment 6</title>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width">
  6. <style>
  7. h3 {color: blue; text-align: center;}
  8. label
  9. {width: 10em;
  10. padding-right: 1em;
  11. float: left;}
  12. div.one
  13. {
  14. width:150px;
  15. height:1000px;
  16. padding:auto;
  17. border:2px black;
  18. border-right-color:black;
  19. margin:0px;
  20. background-color: tomato;
  21. position:absolute;
  22. left:0px;
  23. top:0px;
  24. text-align:center;}
  25. div.two
  26. {
  27. width:450px;
  28. height:500px;
  29. padding:auto;
  30. border:1px rosybrown;
  31. margin:0px;
  32. position:absolute;
  33. left:150px;
  34. top:0px;
  35. text-align:center;}
  36. body
  37. {
  38. background-image:url('http://www.sfsu.edu/~recsport/images/sfsupillar.jpg');
  39. background-repeat:no-repeat;
  40. background-size: 500px 500px;
  41. background-position: 120px 0px;
  42. }
  43. div.three
  44. {
  45. width:400px;
  46. height:485px;
  47. padding:10px;
  48. border:1px teal;
  49. margin:0px;
  50. position:absolute;
  51. left:600px;
  52. top:0px;
  53. text-align:left;
  54. background-color: darkcyan;
  55. }
  56. div.four
  57. {
  58. width:850px;
  59. height:500px;
  60. padding:10px;
  61. border:1px solid gray;
  62. margin:0px;
  63. background-color: red;
  64. position:absolute;
  65. left:150px;
  66. top:350px;
  67. }
  68. </style>
  69. <script>
  70. function ComputeFV()
  71. {
  72. //myPV=eval(document.fvForm.PV.value);
  73. myPV=parseFloat(document.getElementById("PV").value);
  74. myRate=parseFloat(document.getElementById("Rate").value);
  75. if (document.getElementById("Year10").checked)
  76. {myYear=10;}
  77. else if (document.getElementById("Year15").checked)
  78. {myYear=15;}
  79. else
  80. {myYear=30;}
  81. fv=myPV*Math.pow(1+myRate,myYear);
  82. document.fvForm.FV.value=fv.toString();
  83. }
  84. </script>
  85. <script>
  86. function showTable(){
  87. value=eval(document.depForm.pValue.value);
  88. life=eval(document.depForm.pLife.value);
  89. depreciation = value / life;
  90. var table = document.getElementById('depTable');
  91. var totalDepreciation=0;
  92. for(var i = table.rows.length -1; i > 0; i--)
  93. {
  94. table.deleteRow(i);
  95. }
  96. for (count = 1; count <= life; count++)
  97. {
  98. var rowCount = table.rows.length;
  99. var row = table.insertRow(rowCount);
  100. var cell0 = row.insertCell(0);
  101. cell0.innerHTML=count;
  102. var cell1 = row.insertCell(1);
  103. cell1.innerHTML="$" + value.toFixed(2);
  104. var cell2 = row.insertCell(2);
  105. cell2.innerHTML="$" + depreciation.toFixed(2);
  106. totalDepreciation += depreciation;
  107. var cell3 = row.insertCell(3);
  108. cell3.innerHTML="$" + totalDepreciation.toFixed(2);
  109. value -= depreciation;
  110. }
  111. }
  112. function Validating(){
  113. var Valid, Valid2;
  114. Valid=true;
  115. Valid2=true;
  116. if (document.depForm.pValue.value==="" ||document.depForm.pLife.value==="")
  117. {Valid=false;}
  118. if (isNaN(document.depForm.pValue.value) ||isNaN(document.depForm.pLife.value))
  119. {Valid2=false;}
  120. if (Valid===false)
  121. {alert("Property value or life MUST NOT BE BLANK");}
  122. if (Valid2===false)
  123. {alert("DIGITS ONLY!");}
  124. if (Valid && Valid2)
  125. {
  126. showTable();
  127. }
  128. }
  129. </script>
  130. </head>
  131. <body>
  132. <div class="one"> <h3>This is Div 1</h3><br>
  133. <h3>My favorite links:</h3> <br>
  134. <a href="http://www.facebook.com">Facebook</a> <br>
  135. <a href="http://www.youtube.com">YouTube</a> <br>
  136. <a href="http://www.netflix.com">Netflix</a> <br>
  137. </div>
  138. <div class="two"> <h3>This is Div 2</h3><br>
  139. </div>
  140. <div class="three"><h3>This is Div 3</h3><br>
  141. <form name="fvForm">
  142. Enter PV: <input type="text" name="PV" id="PV" value=""><br><br>
  143. <select name="Rate" id="Rate">
  144. <option value=.03>3%</option>
  145. <option value=.04>4%</option>
  146. <option value=.05>5%</option>
  147. <option value=.06>6%</option>
  148. <option value=.07>7%</option>
  149. <option value=.08>8%</option>
  150. </select><br>
  151. <br>
  152. Select Year <br>
  153. <input type="radio" name="Year" value=10 id="Year10"/>10-year<br>
  154. <input type="radio" name="Year" value=15 id="Year15"/>15-year <br>
  155. <input type="radio" name="Year" value=30 id="Year30"/>30-year <br>
  156. <br>
  157. Future Value: <input type="text" name="FV" id="FV" value="" /><br>
  158. <input type="button" value="ComputeFV" name="btnCompute" onclick="ComputeFV()"/><br>
  159.  
  160. </form>
  161. </div>
  162. <div class="four"><h3>This is Div 4</h3><br>
  163. <form name="depForm">
  164. Straight Line Depreciation Table<br>
  165. Enter Property Value: <input type="text" name="value" id="value" value=""><br>
  166. Enter Property Life: <input type="text" name="life" id="life" value=""><br>
  167. <input type="button" value="Show Table" onclick="showTable()"/><br>
  168. <table id=depTable>
  169. </table>
  170. </div>
  171. </form>
  172. </body>
  173. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement