Go Back   Computer Forums > Web Design | Website Development > Web Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 09-22-2006, 11:56 PM   #1
Solid State Member
 
Join Date: Sep 2006
Posts: 10
Default Homework Help #2 (Javascript)

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>
__________________

ascendantofrain is offline   Reply With Quote
Old 09-25-2006, 11:13 AM   #2
Baseband Member
 
Join Date: Sep 2006
Posts: 84
Send a message via AIM to Noxious020189
Default Re: Homework Help #2 (Javascript)

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.
__________________

__________________
"Not one cyborg part among them, and yet there not afraid to die." - Ghost In The Shell: Stand Alone Complex ~Batou
Noxious020189 is offline   Reply With Quote
Old 09-25-2006, 03:37 PM   #3
Solid State Member
 
Join Date: Sep 2006
Posts: 10
Default Re: Homework Help #2 (Javascript)

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!
ascendantofrain is offline   Reply With Quote
Old 09-26-2006, 12:21 AM   #4
Golden Master
 
ISOwner's Avatar
 
Join Date: Dec 2004
Posts: 12,208
Default Re: Homework Help #2 (Javascript)

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.
__________________
*Fact: Microsoft Window's Blue Screen of Death vs Computerforums.org's White Screen of Death. Which is worse?
ISOwner is offline   Reply With Quote
Old 09-27-2006, 05:18 PM   #5
Solid State Member
 
Join Date: Sep 2006
Posts: 10
Default Re: Homework Help #2 (Javascript)

Nevermind guys, I figured out the problem.....pretty simple...

The form was supposed to be a "post" form, not a "text" form...sillee me!
ascendantofrain is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 04:47 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0