Web Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsWeb DesignWeb Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old November 12th, 2011, 12:27 PM
Devbev2450 Devbev2450 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2011
Posts: 1 Devbev2450 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 10 m 34 sec
Reputation Power: 0
Form(java) works in all browsers cept IE

So I am making a website for my class and it requires a java script form. Its for an airline.
Anyways, when i made it i tested it in Google chrome. when i was done, i tested it in internet explorer (both 8 and 9), Firefox, and Chrome. Internet Explore (8 & 9) could not process the form properly. it keeps saying $NaN in the alert box and i tried to parseInt stuff to see if that would help and it did not. So i just need a little guidance on why this is happening. HERE IS MY CODE:
Code:
<html>
<head>
	<title>DWOOD Reservations</title>
	<link rel="stylesheet" type="text/css" href="airline.css" />
	<style type="text/css">

	body{background-color:FFCC99;}
	img{display:block; margin-left: auto; margin-right: auto;}
	p.slogan{text-align:center; font-style: italic; font-family: arial; font-size:140%;}
	form{border-style:solid; border: 10 px outset FF6600; text-align: left;}
	span{font-family: arial; font-size: 120%;}
	ul {list-style-type: none; margin: 0; padding: 0; }

	</style>
	<script type="text/javascript">



	function tripCost()
	{
		var cityCost;
		var totalCost;
		var extraBaggage;
		var hotelCost;
		var numberOfDays;
		var firstName = document.reservation.txtFirstName.value;
		var lastName = document.reservation.txtLastName.value;

		if ( document.reservation.radArrivalCity[0].checked )
			{
			cityCost = 200;
			}
		else if ( document.reservation.radArrivalCity[1].checked )
			{
			cityCost = 250;
			}
		else if ( document.reservation.radArrivalCity[2].checked )
			{
			cityCost = 300;
			}

		totalCost = cityCost;

		if ( document.reservation.chkFirstClass.checked )
			{
			totalCost = totalCost * 2;
			}

		if ( document.reservation.chkPet.checked )
			{
			totalCost = totalCost + 50;
			}

		extraBaggage = document.reservation.selBaggage.value;
		extraBaggage = parseInt(extraBaggage);

		totalCost = totalCost + (extraBaggage * 30);


		if ( document.reservation.radHotel[0].checked )
			{
			hotelCost = 100;
			}
		else if ( document.reservation.radHotel[1].checked )
			{
			hotelCost = 200;
			}
		else if (document.reservation.radHotel[2].checked )
			{
			hotelCost = 300;
			}

		numberOfDays = document.reservation.selNumDays.value;
		numberOfDays = parseInt(numberOfDays);

		totalCost = totalCost + (hotelCost * numberOfDays);


		alert("Thank you " + firstName + " " + lastName + " for booking a flight with D-WOOD Airlines! Your total cost for this trip is $" + totalCost + ". Enjoy your trip!");


	}


	</script>
</head>
<body>
	<div id="header">

	<h2>D-WOOD AIRLINES</h2>

	<img src="airplane.jpg" alt="airplane"/>

	<p class="slogan">"Start off your trip with a great flight!"<p>

	</div>

	<div id="main_content">

	<h1>Book your flight here!</h1>

	<form name="reservation">

	<p>
	Last Name:
	<input type="text" name="txtLastName" />
	</p>

	<p>
	First Name:
	<input type="text" name="txtFirstName" />
	</p>

	<p>
	<ul>Arrival City: <br />
		<li><input type="radio" name="radArrivalCity" />New York</li>
		<li><input type="radio" name="radArrivalCity" />Las Vegas</li>
	 	<li><input type="radio" name="radArrivalCity" />Seattle</li>
	</ul>
	</p>

	<p>
	Number of Extra Bags:<select name=selBaggage>
		<option val="0">0</option>
		<option val="1">1</option>
		<option val="2">2</option>
		<option val="3">3</option>
	</select>
	</p>

	<p>
	<ul>Please Check the Following:<br />
		<li><input type="checkbox" name="chkFirstClass" />First Class</li>
		<li><input type="checkbox" name="chkPet" />Traveling with Pet</li>
	</ul>
	</p>

	<p>
	Number of Days: &nbsp; &nbsp; &nbsp; &nbsp;
	<select name=selNumDays>
		<option val="3">3</option>
		<option val="4">4</option>
		<option val="5">5</option>
		<option val="6">6</option>
		<option val="7">7</option>
		<option val="8">8</option>
	</select>
	</p>

	<p>
		<a href="(URL address blocked: See forum rules)" target="_blank">CLICK HERE TO VIEW A 2011 CALENDAR</a>
	</p>

	<p>
	<ul>Please choose your preferred hotel:
		<li><input type="radio" name="radHotel" value="economy">Economy Hotel</li>
		<li><input type="radio" name="radHotel" value="standard">Standard Hotel</li>
		<li><input type="radio" name="radHotel" value="upscale">Upscale Hotel</li>
	</ul>
	</p>

	<p>
	Special Requests:<br />
	<textarea name="txtarRequests" cols="50" rows="10">
	</textarea>
	</p>

	<input type="checkbox" name"chkAgree" checked="checked">I agree to book a vacation with DWOOD Airlines and that my credit card will be charged once I press submit.</input>

	<p>
	<input type="button" name="btnSubmit" value="Book My Ticket!" onClick="tripCost()" />
	</p>

	</form>

	</div>

	<div id="footer">

	<h3>
	Please navigate to different pages of our website using the links provided below!
	</h3>

	<p class="links">
	<a href="airline.html">HOME</a>|<a href="reservation.html">MAKE A RESERVATION</a>|<a href="contact.html">CONTACT US</a>|<a href="mailing.html">JOIN OUR MAILING LIST</a>
	</p>

	</div>

</body
</html>

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsWeb DesignWeb Development > Form(java) works in all browsers cept IE


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap