Homework Help #2 (Javascript)

ascendantofrain

Solid State Member
Messages
10
Hey guys, I need some help again but this time it is for my Web Site Administration class. I need to create an .asp file that asks a user to enter their name, and to choose whether to rent a full size, medium size, or small size car. The form should prompt users to enter the number of days to rent the car. I must add a submit button to send the form's data to a server side script and a reset button to clear the data. Here are some criteria:
- if a user chooses to rent full size, the charge is going to be $54.99/day.
- if a user chooses to rent medium size, the charge is going to be $45.99/day.
- Small size cars cost $36.99/day.

Then the following data should be displayed at the bottom of the page: customer name, car size, days of renting, and total cost.

Here is my attempt but to no avail

Code:
<%@ language="javascript" %>
<html>
<body>
	<form method="text" action="ex3.asp">
	Name: <input type="text" name="firstname"><br />
	# of Days: <input type="text" name="nodays" ><br />
	<input type="radio" name="size" value="full">full size <br />
	<input type="radio" name="size" value="med">medium size <br />
	<input type="radio" name="size" value="small">small size <br />
	<br />
	<input type="submit" value="Send Data"> <br />
	<input type="reset" value="Clear"> <br />
	</form>
	
	<%
		var carSize = Request.Form("size");
		var daysRent = Request.Form("nodays");
		var currCost = 0;
		var renter = Request.Form("firstname");
	
		if (carSize == "full")
			currCost = (daysRent * 54.99)
		else if (carSize == "med")
			currCost = (daysRent * 45.99)
		else if (carSize == "small")
			currCost = (daysRent * 36.99)
		
			
		Response.Write(renter + ", your total cost to rent a" + carSize + "car for" + daysRent + "is" + currCost);
	%>
</body>
</html>
 
I don't know much about this language YET, but shouldn't be style/text="javascript". I highly doubt that your wrong, but biggest problems occur from the simplist mistake.
 
I am almost positive that part is right becasue that is how our intstructor howed us and it has worked on other projects....thanks anyways!
 
Well, I'm taking Java class this quarter. Hope I will be of some help once I get full blown into it. Right now, I'm intalling JS2E Development Kit and Eclipse.
 
Nevermind guys, I figured out the problem.....pretty simple...

The form was supposed to be a "post" form, not a "text" form...sillee me!
 
Back
Top Bottom