{ "key_pair_value_system": true, "answer_rating_count": "", "question_feedback_html": { "html_star": "", "html_star_feedback": "" }, "answer_average_rating_value": "", "answer_date_js": "2024-08-28T06:28:26-04:00", "answer_date": "2024-08-28 06:28:26", "is_docs_available": null, "is_excel_available": null, "is_pdf_available": null, "count_file_available": 0, "main_page": "student_question_view", "question_id": "8562713", "url": "\/study-help\/questions\/debug-fvjs-for-two-errors-then-upload-only-the-corrected-8562713", "question_creation_date_js": "2024-08-28T06:28:26-04:00", "question_creation_date": "Aug 28, 2024 06:28 AM", "meta_title": "[Solved] debug fv.js for TWO errors; then upload o | SolutionInn", "meta_description": "Answer of - debug fv.js for TWO errors; then upload only the corrected fv.js . Here is a copy of the current fv.css body { font-fa | SolutionInn", "meta_keywords": "debug,fvjs,two,errors,upload,corrected,copy,current,fvcss,body,font-family,arial", "question_title_h1": "debug fv.js for TWO errors; then upload only the corrected fv.js . Here is a copy of the current fv.css body { font-family: Arial, Helvetica,", "question_title": "debug fv.js for TWO errors; then upload only the corrected fv.js .", "question_title_for_js_snippet": "debug fv js for TWO errors then upload only the corrected fv js Here is a copy of the current fv css body font family Arial, Helvetica, sans serif background color white width 600px margin 0 auto padding 0 2em 1em border 3px solid blue h1 color blue margin bottom 25em label float left width 11em text align right input margin left 1em margin bottom 5em margin right 5em width 11em span color red Then the fv js use strict var $ function (id) return document getElementById(id) var calculateFV function(investment, rate, years) var futureValue investment for (var i 1 i 100000) investment nextElementSibling firstChild nodeValue Must be 1 100000 ok false else investment nextElementSibling firstChild nodeValue if (rate value ) rate nextElementSibling firstChild nodeValue Rate is required ok false else if (isNaN(parseFloat(rate value))) rate nextElementSibling firstChild nodeValue Must be numeric ok false else if (rate value 1 rate value 15) rate nextElementSibling firstChild nodeValue Must be 1 15 ok false else rate nextElementSibling firstChild nodeValue if (years value ) years nextElementSibling firstChild nodeValue Years is required ok false else if (isNaN(parseInt(years value))) years nextElementSibling firstChild nodeValue Must be integer ok false else if (years value 1 years value 50) years nextElementSibling firstChild nodeValue Must be 1 50 ok false else years nextElementSibling firstChild nodeValue if (ok) $( future value ) value calculateFV(parseFloat(investment), parseFloat(rate), parseInt(years)) else $( future value ) value window onload function () $( calculate ) onclick processentries $( investment ) focus() then lastly the index html Future Value Calculator Future Value Calculator Total Investment Annual Interest Rate Number of Years Future Value Please help ", "question_description": "
debug fv.js for TWO errors; then upload only the corrected fv.js<\/strong>.<\/p> Here is a copy of the current fv.css<\/p> body { font-family: Arial, Helvetica, sans-serif; background-color: white; width: 600px; margin: 0 auto; padding: 0 2em 1em; border: 3px solid blue; } h1 { color: blue; margin-bottom: .25em; } label { float: left; width: 11em; text-align: right; } input { margin-left: 1em; margin-bottom: .5em; margin-right: .5em; width: 11em; } span { color: red; }<\/p> <\/p> Then the fv.js<\/p> <\/p> then lastly the index.html<\/p> <\/p> \"use strict\"; var $ = function (id) { return document.getElementById(id); } var calculateFV = function(investment, rate, years) { var futureValue = investment; for (var i = 1; i <= years; i++ ) { futureValue += futureValue * rate \/ 100; } futureValue = futureValue.toFixed(2); return futureValue; } var processEntries = function() { var investment = $(\"investment\"); var rate = $(\"annual_rate\"); var years = $(\"years\"); var ok = true; if (investment.value == \"\") { investment.nextElementSibling.firstChild.nodeValue = \"Principal Investment is required.\"; ok = false; } else if (isNaN(parseFloat(investment.value))) { investment.nextElementSibling.firstChild.nodeValue = \"Must be numeric.\"; ok = false; } else if (investment.value<1 || investment.value>100000) { investment.nextElementSibling.firstChild.nodeValue = \"Must be 1..100000.\"; ok = false; } else { investment.nextElementSibling.firstChild.nodeValue = \"\"; } if (rate.value == \"\") { rate.nextElementSibling.firstChild.nodeValue = \"Rate is required.\"; ok = false; } else if (isNaN(parseFloat(rate.value))) { rate.nextElementSibling.firstChild.nodeValue = \"Must be numeric.\"; ok = false; } else if (rate.value<1 || rate.value>15) { rate.nextElementSibling.firstChild.nodeValue = \"Must be 1..15.\"; ok = false; } else { rate.nextElementSibling.firstChild.nodeValue = \"\"; } if (years.value == \"\") { years.nextElementSibling.firstChild.nodeValue = \"Years is required.\"; ok = false; } else if (isNaN(parseInt(years.value))) { years.nextElementSibling.firstChild.nodeValue = \"Must be integer.\"; ok = false; } else if (years.value<1 || years.value>50) { years.nextElementSibling.firstChild.nodeValue = \"Must be 1..50.\"; ok = false; } else { years.nextElementSibling.firstChild.nodeValue = \"\"; } if (ok) { $(\"future_value\").value = calculateFV(parseFloat(investment), parseFloat(rate), parseInt(years)); } else { $(\"future_value\").value = \"\"; } } window.onload = function () { $(\"calculate\").onclick = processentries; $(\"investment\").focus(); }<\/pre>