How do I calculate a percentage off of a certain input value?
So I'm in an intro to web development class and our assignment is to create a form that calculates fees for a charter boat company. I have the basic form, however, I can't seem to figure out how to take a percentage off of an input value. In example, I want to take 10% off of the total fee if a customer books more than 8 hours. Here is the website to our assignment if needed: http://is1500.weebly.com/assignment-7.html
<div>Number of Hours: <input type="text" id="hours"><br/>
Number of Guests: <input type="text" id="guests"><br/>
Docking at Oak Bluffs? <input type="checkbox" id="docking"></br>
Need Fishing Gear? <input type="checkbox" id="fishing">
<p>
<button onClick="calculate()">Calculate Fee</button>
<p>
Based on your input, your charter fee is going to be<span id="fee">...</span>
<script>
function calculate()
{
var fee = document.getElementById("hours").value;
var guests = document.getElementById("guests").value;
var dock = document.getElementById("docking").checked;
var dockingFee;
var fishing = document.getElementById("fishing").checked;
var fishingFee;
pleeeease help my head hurts from trying so many different times... I figure >8 would be understood i just don't understand how to write it out to relate to var fee
Bookmarks