Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Assignment 6</title>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width">
- <style>
- h3 {color: blue; text-align: center;}
- label
- {width: 10em;
- padding-right: 1em;
- float: left;}
- div.one
- {
- width:150px;
- height:1000px;
- padding:auto;
- border:2px black;
- border-right-color:black;
- margin:0px;
- background-color: tomato;
- position:absolute;
- left:0px;
- top:0px;
- text-align:center;}
- div.two
- {
- width:450px;
- height:500px;
- padding:auto;
- border:1px rosybrown;
- margin:0px;
- position:absolute;
- left:150px;
- top:0px;
- text-align:center;}
- body
- {
- background-image:url('http://www.sfsu.edu/~recsport/images/sfsupillar.jpg');
- background-repeat:no-repeat;
- background-size: 500px 500px;
- background-position: 120px 0px;
- }
- div.three
- {
- width:400px;
- height:485px;
- padding:10px;
- border:1px teal;
- margin:0px;
- position:absolute;
- left:600px;
- top:0px;
- text-align:left;
- background-color: darkcyan;
- }
- div.four
- {
- width:850px;
- height:500px;
- padding:10px;
- border:1px solid gray;
- margin:0px;
- background-color: red;
- position:absolute;
- left:150px;
- top:350px;
- }
- </style>
- <script>
- function ComputeFV()
- {
- //myPV=eval(document.fvForm.PV.value);
- myPV=parseFloat(document.getElementById("PV").value);
- myRate=parseFloat(document.getElementById("Rate").value);
- if (document.getElementById("Year10").checked)
- {myYear=10;}
- else if (document.getElementById("Year15").checked)
- {myYear=15;}
- else
- {myYear=30;}
- fv=myPV*Math.pow(1+myRate,myYear);
- document.fvForm.FV.value=fv.toString();
- }
- </script>
- <script>
- function showTable(){
- value=eval(document.depForm.pValue.value);
- life=eval(document.depForm.pLife.value);
- depreciation = value / life;
- var table = document.getElementById('depTable');
- var totalDepreciation=0;
- for(var i = table.rows.length -1; i > 0; i--)
- {
- table.deleteRow(i);
- }
- for (count = 1; count <= life; count++)
- {
- var rowCount = table.rows.length;
- var row = table.insertRow(rowCount);
- var cell0 = row.insertCell(0);
- cell0.innerHTML=count;
- var cell1 = row.insertCell(1);
- cell1.innerHTML="$" + value.toFixed(2);
- var cell2 = row.insertCell(2);
- cell2.innerHTML="$" + depreciation.toFixed(2);
- totalDepreciation += depreciation;
- var cell3 = row.insertCell(3);
- cell3.innerHTML="$" + totalDepreciation.toFixed(2);
- value -= depreciation;
- }
- }
- function Validating(){
- var Valid, Valid2;
- Valid=true;
- Valid2=true;
- if (document.depForm.pValue.value==="" ||document.depForm.pLife.value==="")
- {Valid=false;}
- if (isNaN(document.depForm.pValue.value) ||isNaN(document.depForm.pLife.value))
- {Valid2=false;}
- if (Valid===false)
- {alert("Property value or life MUST NOT BE BLANK");}
- if (Valid2===false)
- {alert("DIGITS ONLY!");}
- if (Valid && Valid2)
- {
- showTable();
- }
- }
- </script>
- </head>
- <body>
- <div class="one"> <h3>This is Div 1</h3><br>
- <h3>My favorite links:</h3> <br>
- <a href="http://www.facebook.com">Facebook</a> <br>
- <a href="http://www.youtube.com">YouTube</a> <br>
- <a href="http://www.netflix.com">Netflix</a> <br>
- </div>
- <div class="two"> <h3>This is Div 2</h3><br>
- </div>
- <div class="three"><h3>This is Div 3</h3><br>
- <form name="fvForm">
- Enter PV: <input type="text" name="PV" id="PV" value=""><br><br>
- <select name="Rate" id="Rate">
- <option value=.03>3%</option>
- <option value=.04>4%</option>
- <option value=.05>5%</option>
- <option value=.06>6%</option>
- <option value=.07>7%</option>
- <option value=.08>8%</option>
- </select><br>
- <br>
- Select Year <br>
- <input type="radio" name="Year" value=10 id="Year10"/>10-year<br>
- <input type="radio" name="Year" value=15 id="Year15"/>15-year <br>
- <input type="radio" name="Year" value=30 id="Year30"/>30-year <br>
- <br>
- Future Value: <input type="text" name="FV" id="FV" value="" /><br>
- <input type="button" value="ComputeFV" name="btnCompute" onclick="ComputeFV()"/><br>
- </form>
- </div>
- <div class="four"><h3>This is Div 4</h3><br>
- <form name="depForm">
- Straight Line Depreciation Table<br>
- Enter Property Value: <input type="text" name="value" id="value" value=""><br>
- Enter Property Life: <input type="text" name="life" id="life" value=""><br>
- <input type="button" value="Show Table" onclick="showTable()"/><br>
- <table id=depTable>
- </table>
- </div>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement