Question

In: Computer Science

My Javascript code isn't working (when i press calculate button) - what's wrong with it ?...

My Javascript code isn't working (when i press calculate button) - what's wrong with it ?

Car Rental

Enter Number of Rental Days:





Select Car Type:

onclick= "priceofcar = 50;"/> Compact


onclick= "priceofcar = 60;"/> Economy


onclick= "priceofcar = 70;"/> Intermediate

Select Loss Damage Waiver

onclick= "damagewaiver='yes'"/> Yes

onclick= "damagewaiver='no'"/> No


damagewaiver = boxDays.value * 25;}
else if (damagewaiver == No) {
damagewaiver = 0; }/>




Select Roadside Issues Coverage:

onclick= "issuescoverage='yes'"/> Yes

onclick= "issuescoverage='no'"/> No


issuescoverage = boxDays.value * 9;}
else if (issuescoverage == No) {
issuescoverage = 0; }/>

value = "Process"
onclick = "
myVariable = boxDays.value
boxrental = priceofcar * myVariable
boxoptional = damagewaiver + issuescoverage
boxsales = 0.7 * (boxoptional.value + boxrental.value)
boxtotal = boxsales.value + boxoptional.value + boxrental.value"/>
  


Car Rental Price:




Optional Items:




Sales Tax:




Total Bill:






Solutions

Expert Solution

You are using onclick event in option tag to get the selected value. The onclick event wont supported with the option tag. so you didnt get the values for calculation and nothing displayed. You need to use the onchange function on select tag to get the selected value as follows: html

<span>select car type></span>
<select id="carbox" onchange="carbox();">
<option value="50">compact</option>
<option value="60" >economy</option>
<option value="70">intermediate</option>
</select>

and in your script write the code as follows:

<script type="text/javascript">
function carbox(){
   var  carvalue= document.getElementById("carbox").value;
   alert(carvalue);
console.log(carvalue);
}
</script>

using the same for the remaining selection crieria. and do the calculation. Dont forget to add the script part inside header tag of your html .


Related Solutions

What's wrong with my Python code. We have to find the regularexpression in Python My output...
What's wrong with my Python code. We have to find the regularexpression in Python My output should look like this My IP address 128. 0. 0. 1 My IP address 53. 20. 62. 201 My code ipAddresses = [] ipRegEx = re.compile(r"\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}")    result = myRegEx.find all(Search Text)    def Regular_expression(ipAddresses)       for i in ipAddresses:          print(i) ipSearchResult = ipRegEx.search(line)    if ipSearchResult != None and ipSearchResult.group() not in ipAddresses:       ipAddresses.append(ipSearchResult.group()) we have to use loop too.
hi i do not know what is wrong with my python code. this is the class:...
hi i do not know what is wrong with my python code. this is the class: class Cuboid: def __init__(self, width, length, height, colour): self.__width = width self.__length = length self.__height = height self.__colour = colour self.surface_area = (2 * (width * length) + 2 * (width * height) + 2 * (length * height)) self.volume = height * length * width def get_width(self): return self.__width def get_length(self): return self.__length def get_height(self): return self.__height def get_colour(self): return self.__colour def set_width(self,...
I was wondering is someone could tell me why my code isn't compiling - Java ------------------------------------------------------------------------------------------------------------...
I was wondering is someone could tell me why my code isn't compiling - Java ------------------------------------------------------------------------------------------------------------ class Robot{ int serialNumber; boolean flies,autonomous,teleoperated; public void setCapabilities(int serialNumber, boolean flies, boolean autonomous, boolean teleoperated){ this.serialNumber = serialNumber; this.flies = flies; this.autonomous = autonomous; this.teleoperated = teleoperated; } public int getSerialNumber(){ return this.serialNumber; } public boolean canFly(){ return this.flies; } public boolean isAutonomous(){ return this.autonomous; } public boolean isTeleoperated(){ return this.teleoperated; } public String getCapabilities(){ StringBuilder str = new StringBuilder(); if(this.flies){str.append("canFly");str.append(" ");} if(this.autonomous){str.append("autonomous");str.append("...
I have an unexpected indent with my python code. please find out whats wrong with my...
I have an unexpected indent with my python code. please find out whats wrong with my code and run it to show that it works here is the code : def main(): lis = inputData() customerType = convertAcct2String(lis[0]) bushCost = getBushCost(lis[0],int(lis[1],10)) flowerCost = getFlowerBedCost(int(lis[2],10),int(lis[3],10)) fertiCost = getFertilCost(int(lis[4],10)) totalCost = calculateBill(bushCost,fertiCost,flowerCost) printReciept(customerType,totalCost,bushCost,fertiCost,flowerCost) def inputData(): account, number_of_bushes,flower_bed_length,flower_bed_width,lawn_square_footage = input("Please enter values").split() return [account, number_of_bushes,flower_bed_length,flower_bed_width,lawn_square_footage] def convertAcct2String(accountType): if accountType== "P": return "Preferred" elif accountType == "R": return "Regular" elif accountType == "N": return...
/* What's wrong with this code? (nothing actually - but let's fix it to use a...
/* What's wrong with this code? (nothing actually - but let's fix it to use a repetition structure) Copy and paste this .txt file into jGrasp, then save it, compile it, run it. Modify it! Bring your code to class at the start of Week 8, with at least 2 output runs with different data. What the program should do is take orders(input) for three (3) octoberfest guests, using a "for" loop. (+1 pt.) Each guest will choose 1 or...
Below is my source code for file merging. when i run the code my merged file...
Below is my source code for file merging. when i run the code my merged file is blank and it never shows merging complete prompt. i dont see any errors or why my code would be causing this. i saved both files with male names and female names in the same location my source code is in as a rtf #include #include #include using namespace std; int main() { ifstream inFile1; ifstream inFile2; ofstream outFile1; int mClientNumber, fClientNumber; string mClientName;...
javaScript html receives an entry of a character string in a text box, when a button...
javaScript html receives an entry of a character string in a text box, when a button is clicked, the count of vowels in the string stored in the textbox is displayed. The html file contains one function: vowelcount(). vowelcount(): returns the number of uppercase and lowercase English language vowel letter that occurs in the string entry in the textbox. //html: <!--    YOUR ID    YOUR NAME --> <html> <head> <script> function vowelcount() {        /* YOUR CODE HERE...
Working with Python. I am trying to make my code go through each subject in my...
Working with Python. I am trying to make my code go through each subject in my sample size and request something about it. For example, I have my code request from the user to input a sample size N. If I said sample size was 5 for example, I want the code to ask the user the following: "Enter age of subject 1" "Enter age of subject 2" "Enter age of subject 3" "Enter age of subject 4" "Enter age...
I am getting 7 errors can someone fix and explain what I did wrong. My code...
I am getting 7 errors can someone fix and explain what I did wrong. My code is at the bottom. Welcome to the DeVry Bank Automated Teller Machine Check balance Make withdrawal Make deposit View account information View statement View bank information Exit          The result of choosing #1 will be the following:           Current balance is: $2439.45     The result of choosing #2 will be the following:           How much would you like to withdraw? $200.50      The...
My code is working fine but after selecting an option and at the end I want...
My code is working fine but after selecting an option and at the end I want user could enter another option again without going back to menu. However, in my code when I enter another option, it prints the whole menu again then I can select option.Could anyone help me on that? #include "stdafx.h" #include #include #include using namespace std; const double pi = 3.14159265358979323846; const double deg_to_rad = (pi / 180); int main() { int option; do { cout...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT