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,...
This code needs to run a working Reverse Polish Calculator, but when I input my commands...
This code needs to run a working Reverse Polish Calculator, but when I input my commands it only pops my inputs never push them. So my answer is always zero. Here is my code. #include <stdio.h> #include <stdlib.h> #include <stdbool.h> struct Node { int element; struct Node *next; }; //Global variable struct Node *top = NULL; void push(int ele) { struct Node *newNode; newNode = (struct Node *) malloc(sizeof(struct Node)); newNode->element = ele; newNode->next = top; top = newNode; }...
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...
My class PayCalculator isn't implementing the interface Constants, it did this before but when I saved...
My class PayCalculator isn't implementing the interface Constants, it did this before but when I saved it went nuts. I was wondering how to fix it? import java.text.DecimalFormat; public class PayCalculator implements Constants {       private String employeeName;    private int reportID;    private double hourlyWage;    private static int ID = 0;    private static int reportIDGenerator = 1000;    public int[] overtimes = HOURS_WORKED; public PayCalculator(String name) {    public PayCalculator() {    this.reportID = reportIDGenerator;   ...
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...
In Microbots, When you press the red stop button of the teach pendant in the middle...
In Microbots, When you press the red stop button of the teach pendant in the middle of the execution of a @STEP command, the Microbot stops immediately. Given that there are no sensors to independently determine the current position and orientation, how can you prepare for and recover from this event without having to recalibrate the robot manually to its home position? Assume that no slippage occurs. Please include algorithm in pseudocode to explain the solution.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT