View Single Post
Old 01-23-2013, 05:32 PM   PM User | #3
andynov123
Regular Coder

 
Join Date: Oct 2010
Posts: 246
Thanks: 8
Thanked 1 Time in 1 Post
andynov123 is an unknown quantity at this point
I added the .value and the parseFloat, but I still don't know why the prompt from displayTotal() wont appear.

UPDATED CODE
Code:
<html>

<head>
<title>AMC Ticket Calculator</title>




<style type="text/css">
#welcome{color:red;font-size:35px;font-family:impact;}
body{border-style:solid;overflow:hidden;border-color:red;
border-width:20px;}
#please{font-size:20px;color:red;font-weight:bold;}
#please1{font-size:20px;color:red;font-weight:bold;}
#please2{font-size:20px;color:red;font-weight:bold;}
#logo
{
float:right;margin-top:-45px;margin-right:200px;
}
#info
{
	
	font-weight:bold;
	margin-top:10px;
font-size:15px;	
}
#clear{
	margin-top:240px;
	
	}
#calculate{
border-style:solid;border-color:red;width:300px;height:300px;float:right;margin-top:-480px;text-align:center;color:red;font-weight:bold;font-size:20px;}



</style>
</head>
<body>
<center><div id="welcome">Welcome to the <img src
="https://si0.twimg.com/profile_images/2391543757/ar8n1bu3oc6mo4am5ef1_normal.jpeg" alt="logo"/>Ticket Calculator</div></center>	

<form>
<center>
<div id="please">Please enter what time frame the movie is in:</div>
<input Id="beforenoon" type="radio" name="showtype"
value="beforenoon">Before 12 P.M.<br>
<input Id="twelvetofour" type="radio" name="showtype"
value="twelvetofour">Between 12 P.M. and 4 P.M.<br>
<input Id="afterfour" type="radio" name="showtype"
value="afterfour">After 4 P.M.<br><br>








<div id="please1">Please enter the quantity of each ticket</div>
Please leave blank any that do not apply<br>


Adult:<input Id="adult" type="text" size="1" name="adult" ><br>
Child:<input Id="child" type="text" size="1" name="child" ><br>
Senior:<input Id="senior" type="text" size="1" name="senior" ><br>
Military:<input Id="military" type="text" size="1" name="military" ><br>
Senior Day Ticket:<input Id="seniorday" type="text" size="1"
name="seniorday" ><br>
Student Day Ticket:<input Id="studentday" type="text" size="1"
name="studentday" ><br>
<br>
<div id="please2">Please enter additional information if needed</div>
How many tickets are regular<b>3D?</b><input Id="threed"
type="text" size="1" name="quantity" >($3.50 additio
nal charge per
ticket)<br>
How many tickets are <b>IMAX(NO 3D)?</b><input Id="imax"
type="text" size="1" name="quantity" >($4.50 additional charge per
ticket)<br>
How many tickets are <b>IMAX 3D?</b><input Id="imax3d" type="text"
size="1" name="quantity" >($5.50 additional charge per ticket)<br>

<script type="text/javascript">



function displayTotal(){
var adult = document.getElementbyId('adult').value;
var child = document.getElementbyId('child').value;
var senior = document.getElementbyId('senior').value;
var military = document.getElementbyId('military').value;
var seniorday = document.getElementbyId('seniorday').value;
var studentday = document.getElementbyId('studentday').value;
var total = parseFloat(adult + child + senior + military + seniorday + studentday);
prompt("The total is " + total);
}


</script>

<br>
<input type="button" onClick="displayTotal()" value="Calculate Now!">

</center>
</form>

<div id="calculate">
Total Breakdown

<br>
<div id="info">Ticket Type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Quantity&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Price</div>
<div id="clear"><input type="button" value="Clear Everything and Start Over" onClick="document.location.reload(true)">
</div>
</div>

</div>

</body>



</html>
andynov123 is offline   Reply With Quote