below is code from one of my pages. the cost() function is supposed to add up the values of tAdult, tChild, tSenior and pParking. then the display() function is supposed to display it. unfortunately, when you choose santa's village, 2 adults and 1 child it returns this:<br><br>Adults: $37.9 <br>Children: $18.95 <br>Seniors: $0 <br>Parking: $0 <br> ---------- <br>Total: $56.849999999999994 <br>See web site for Racing Rapids prices<br><br>tTotal should be $56.85(not $56.849999999.....), because that is the sum of 37.9 and 18.95. any ideas why it is doing this? ...and how i can fix it? <br><br><br><br><HTML><br> <HEAD><TITLE>Layers and JavaScript</TITLE><br> <SCRIPT LANGUAGE="JavaScript"><br><br>var vCnt = 0;<br>var vAdult = 0;<br>var vChild = 0;<br>var vSenior = 0;<br>var vTotal = 0;<br>var pAdult = 0;<br>var pChild = 0;<br>var pSenior = 0;<br>var pTotal = 0;<br>var tAdult = 0;<br>var tChild = 0;<br>var tSenior = 0;<br>var pNotes;<br><br>function fWhere() {<br> ind=document.formWhere.vWhere2.selectedIndex;<br> val=document.formWhere.vWhere2.options[ind].value;<br> switch(val) {<br> case "0":<br> pAdult = 5;<br> pChild = 4;<br> pSenior = 4;<br> pParking = 5;<br> pNotes = "Parking available near Mieg's Field";<br> if (document.layers)<br> document.layers["lyr_adler"].visibility='show',<br> document.layers["lyr_brookfield"].visibility='hide',<br> document.layers["lyr_field"].visibility='hide',<br> document.layers["lyr_shedd"].visibility='hide',<br> document.layers["lyr_santa"].visibility='hide';<br> else<br> document.all["lyr_adler"].style.visibility='visible',<br> document.all["lyr_brookfield"].style.visibility='hidden',<br> document.all["lyr_field"].style.visibility='hidden',<br> document.all["lyr_shedd"].style.visibility='hidden',<br> document.all["lyr_santa"].style.visibility='hidden';<br> break;<br><br> case "1":<br> pAdult = 7;<br> pChild = 3.5;<br> pSenior = 3.5;<br> pParking = 4;<br> pNotes = "Children ages 3 to 11";<br> if (document.layers)<br> document.layers["lyr_adler"].visibility='hide',<br> document.layers["lyr_brookfield"].visibility='show',<br> document.layers["lyr_field"].visibility='hide',<br> document.layers["lyr_shedd"].visibility='hide',<br> document.layers["lyr_santa"].visibility='hide';<br> else<br> document.all["lyr_adler"].style.visibility='hidden',<br> document.all["lyr_brookfield"].style.visibility='visible',<br> document.all["lyr_field"].style.visibility='hidden',<br> document.all["lyr_shedd"].style.visibility='hidden',<br> document.all["lyr_santa"].style.visibility='hidden';<br> break;<br><br> case "2":<br> pAdult = 8;<br> pChild = 4;<br> pSenior = 4;<br> pParking = 5;<br> pNotes = "Children ages 3 to 11";<br> if (document.layers)<br> document.layers["lyr_adler"].visibility='hide',<br> document.layers["lyr_brookfield"].visibility='hide',<br> document.layers["lyr_field"].visibility='show',<br> document.layers["lyr_shedd"].visibility='hide',<br> document.layers["lyr_santa"].visibility='hide';<br> else<br> document.all["lyr_adler"].style.visibility='hidden',<br> document.all["lyr_brookfield"].style.visibility='hidden',<br> document.all["lyr_field"].style.visibility='visible',<br> document.all["lyr_shedd"].style.visibility='hidden',<br> document.all["lyr_santa"].style.visibility='hidden';<br> break;<br><br> case "3":<br> pAdult = 13;<br> pChild = 9;<br> pSenior = 9;<br> pParking = 5;<br> pNotes = "Children ages 3 to 11";<br> if (document.layers)<br> document.layers["lyr_adler"].visibility='hide',<br> document.layers["lyr_brookfield"].visibility='hide',<br> document.layers["lyr_field"].visibility='hide',<br> document.layers["lyr_shedd"].visibility='show',<br> document.layers["lyr_santa"].visibility='hide';<br> else<br> document.all["lyr_adler"].style.visibility='hidden',<br> document.all["lyr_brookfield"].style.visibility='hidden',<br> document.all["lyr_field"].style.visibility='hidden',<br> document.all["lyr_shedd"].style.visibility='visible',<br> document.all["lyr_santa"].style.visibility='hidden';<br> break;<br><br> case "4":<br> pAdult = 18.95;<br> pChild = 18.95;<br> pSenior = 18.95;<br> pParking = 0;<br> pNotes = "See web site for Racing Rapids prices";<br> if (document.layers)<br> document.layers["lyr_adler"].visibility='hide',<br> document.layers["lyr_brookfield"].visibility='hide',<br> document.layers["lyr_field"].visibility='hide',<br> document.layers["lyr_shedd"].visibility='hide',<br> document.layers["lyr_santa"].visibility='show';<br> else<br> document.all["lyr_adler"].style.visibility='hidden',<br> document.all["lyr_brookfield"].style.visibility='hidden',<br> document.all["lyr_field"].style.visibility='hidden',<br> document.all["lyr_shedd"].style.visibility='hidden',<br> document.all["lyr_santa"].style.visibility='visible';<br> break;<br><br> default:<br> pAdult = 5;<br> pChild = 4;<br> pSenior = 4;<br> pParking = 5;<br> }<br> Adult();<br> Child();<br> Senior();<br>}<br><br><br> function Adult() {<br> ind=document.formPeople.vAdultNum.selectedIndex;<br> vAdult=document.formPeople.vAdultNum.options[ind].value;<br> tAdult = vAdult * pAdult;<br><br>}<br><br> function Child() {<br> ind=document.formPeople.vChildNum.selectedIndex;<br> vChild=document.formPeople.vChildNum.options[ind].value;<br> tChild = vChild * pChild;<br>}<br><br> function Senior() {<br> ind=document.formPeople.vSeniorNum.selectedIndex;<br> vSenior=document.formPeople.vSeniorNum.options[ind].value;<br> tSenior = vSenior * pSenior;<br>}<br><br><br>function Cost() {<br> tTotal = tAdult + tChild + tSenior + pParking;<br> display();<br>}<br><br>function display() {<br> DispWin = window.open('','NewWin', 'toolbar=no,status=no,width=300,height=200')<br> DispWin.document.write("<TABLE><TR><TD>"<br> DispWin.document.write("<B>Adults: </B></TD><TD>$" + tAdult + "</TD></TR>"<br> DispWin.document.write("<TR><TD><B>Children: </B></TD><TD>$" + tChild + "</TD></TR>"<br> DispWin.document.write("<TR><TD><B>Seniors: </B></TD><TD>$" + tSenior + "</TD></TR>"<br> DispWin.document.write("<TR><TD><B>Parking: </B></TD><TD>$" + pParking + "</TD></TR>"<br> DispWin.document.write("<TR><TD><B> </B></TD><TD>----------" + "</TD></TR>" );<br> DispWin.document.write("<TR><TD><B>Total: </B></TD><TD><B>$" + tTotal + "</B>"<br> DispWin.document.write("<TR><TD COLSPAN=2>" + pNotes );<br> DispWin.document.write("</TD></TR></TABLE>"<br>}<br><br></SCRIPT></HEAD><br><BODY BGCOLOR = "#EEA600"><br><H2>Calculate your cost</H2><br><FONT FACE="Comic Sans" SIZE=2 COLOR="#FF00GG"><br>Click on the place to which you would like to<br><BR><br>go. Then click the number of people in each<br><BR><br>age group for your party. To get your total<br><BR><br>cost click the "My Cost" button.<br></FONT><br><BR><BR><br>Where would you like to go?<br><FORM NAME="formWhere"><br><SELECT NAME="vWhere2" SIZE=6 onChange="fWhere();"><br><OPTION VALUE=-1 SELECTED>"Nowhere"<br><OPTION VALUE=0>"Adler Planetarium"<br><OPTION VALUE=1>"Brookfield Zoo"<br><OPTION VALUE=2>"Field Museum"<br><OPTION VALUE=4>"Sant's Village"<br><OPTION VALUE=3>"Shedd Aquarium"<br></SELECT><br><INPUT TYPE="button" VALUE="My Cost"<br>onClick="Cost();"><br></FORM><br><br><br><FORM NAME="formPeople"><br>Number of Adults?<br><SELECT NAME="vAdultNum" SIZE=5 onChange="Adult();"><br><OPTION VALUE=1 SELECTED>"One"<br><OPTION VALUE=2>"Two"<br><OPTION VALUE=3>"Three"<br><OPTION VALUE=4>"Four"<br></SELECT><br><br>Number of Children?<br><SELECT NAME="vChildNum" SIZE=5 onChange="Child();"><br><OPTION VALUE=0 SELECTED>"None"<br><OPTION VALUE=1>"One"<br><OPTION VALUE=2>"Two"<br><OPTION VALUE=3>"Three"<br><OPTION VALUE=4>"Four"<br></SELECT><br><br>Number of Seniors?<br><SELECT NAME="vSeniorNum" SIZE=5 onChange="Senior();"><br><OPTION VALUE=0 SELECTED>"None"<br><OPTION VALUE=1>"One"<br><OPTION VALUE=2>"Two"<br><OPTION VALUE=3>"Three"<br><OPTION VALUE=4>"Four"<br></SELECT><br></FORM><br><br><DIV ID="lyr_adler" style="position:absolute; LEFT:325; TOP:15;<br> width:280; height:50; background-color:black;<br> visibility:hidden"><br> <FONT FACE="Comic Sans" SIZE=4 COLOR="#FFFFCC"><br> Adler Planetarium<br> </FONT><br> </BR><br><A HREF = "<A HREF=" TARGET="_new"> SRC="<A HREF=" TARGET="_new"> NO BORDER><br></A><br><BR><br> <FONT FACE="Comic Sans" SIZE=2 COLOR="#FFFFCC"><br>Click on the planet to go to the Adler Planetarium web page.<br></FONT><br></DIV><br><br><DIV ID="lyr_brookfield" style="position:absolute; LEFT:325; TOP:15;<br> width:280; height:50; background-color:white; visibility:hidden"><br> <FONT FACE="Comic Sans" SIZE=4 COLOR="#000000"><br> Brookfield Zoo<br> </FONT><br> </BR><br><A HREF = "<A HREF=" TARGET="_new"> SRC="<A HREF=" TARGET="_new"> NO BORDER><br></A><br><BR><br> <FONT FACE="Comic Sans" SIZE=2 COLOR="#000000"><br>Click on the tiger to go to the Brookfield Zoo web page.<br></FONT><br></DIV><br><br><DIV ID="lyr_field" style="position:absolute; LEFT:325; TOP:15;<br> width:280; height:50; visibility:hidden"><br> <FONT FACE="Comic Sans" SIZE=4 COLOR="#000000"><br> Field Museum<br> </FONT><br> <BR><br><A HREF = "<A HREF=" TARGET="_new"> SRC="<A HREF=" TARGET="_new"> NO BORDER><br></A><br><BR><br> <FONT FACE="Comic Sans" SIZE=2 COLOR="#000000"><br>Click on the dinosaur to go to the Field Museum web page.<br></FONT><br></DIV><br><br><DIV ID="lyr_shedd" style="position:absolute; LEFT:325; TOP:15;<br> width:280; height:50; visibility:hidden"><br> <FONT FACE="Comic Sans" SIZE=4 COLOR="#000000"><br> Shedd Aquarium<br> </FONT><br> <BR><br><A HREF = "<A HREF=" TARGET="_new"> SRC="<A HREF=" TARGET="_new"> NO BORDER><br></A><br><BR><br> <FONT FACE="Comic Sans" SIZE=2 COLOR="#000000"><br>Click on the fish to go to the Shedd Aquarium web page.<br></FONT><br></DIV><br><br><DIV ID="lyr_santa" style="position:absolute; LEFT:325; TOP:15;<br> width:280; height:50; visibility:hidden"><br><A HREF = "<A HREF=" TARGET="_new"> SRC="<A HREF=" TARGET="_new"> NO BORDER><br></A><br><BR><br> <FONT FACE="Comic Sans" SIZE=4 COLOR="#000000"><br> Santa's Village<br> </FONT><br> <BR><br> <FONT FACE="Comic Sans" SIZE=2 COLOR="#000000"><br>Click the Village logo to go to the Santa's Village web site.<br></FONT><br></DIV><br><br></BODY><br></HTML> <p>bobbie<br><a href=mailto:thibault@hotbot.com>thibault@hotbot.com</a><br><a href= </a><br>