Question
I have created a webpage that adds offers each time the user clicks add option. I just have to add an x button that closes
I have created a webpage that adds offers each time the user clicks add option. I just have to add an x button that closes each of the offers when the user clicks it. I bolded what needs to be changed to a button(onclick) in the javascript as well as provided the other code for the project.
html
Financing offer details | |||||||||
|
javascript
function generateOption() {
var offerId = document.getElementById("offerDetails").children.length;
if(offerId < 3){ var initPurchPrice = parseFloat(document.getElementById("purchPrice").value); var cashIncentive = parseInt(document.getElementById("cashIncentive").value); var loanTerms = parseInt(document.getElementById("termInMonths").value); var interestRate = parseFloat(document.getElementById("intRate").value); var interestRatePerMonth = (interestRate/100)/loanTerms; var calculation = Math.pow((1+interestRatePerMonth),loanTerms); var finalPurchPrice = initPurchPrice - cashIncentive; var monthlyPayment = finalPurchPrice*interestRatePerMonth*calculation/(calculation - 1); var html = ''; html += "
Offer "+(offerId+1)+": | "; html +="X | "; html +="
Interest Rate: | "; html += ""+ interestRate +"% | "; html += "
Loan Term (months): | "; html += ""+ loanTerms +" | "; html += "
Monthly Payment: | "; html += "$"+ monthlyPayment +" | "; html += "
Total cost of ownership: | "; html += "$"+ finalPurchPrice +" | "; html += "
}
style css
body { padding :20px; }
div.container { width: 100%; }
.container div{ padding-top:15px; }
.seperator{ border-bottom: 1.5px solid #aaafb3; margin-bottom:10px; } .innerTable { border: 2px solid #aaafb3; border-collapse: separate; border-spacing: 0; margin-top: 2px; } td,th {border:none}
button { background-color: white; border: 1px solid #aaafb3; color: black; padding: 15px 32px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; margin: 4px 2px; cursor: pointer; border-radius: 8px; }
.column{ float: left; width: 32.1%; height: auto; margin-top: 5px; }
.item1, .item2, .item3{ display: block; border:1.5px solid #aaafb3; } .item2, .item3{ margin-left:18.5px; } .pprice{ width: 98%; padding-bottom:5px; border:1.5px solid #bbb2b2; padding:5px; } .innerTable td input{ width: 95%; padding-bottom:5px; border:1.5px solid #bbb2b2; padding:5px; } .offerDetails{ border: 1px solid red; height: 173px; width: 100%; padding: 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started