1.

Solve : java script help?

Answer»

here is a script I am writing and having problems with.  It keeps coming up with an object error.  What have I done wrong.   Thanks in ADVANCED.




http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

http://www.w3.org/1999/xhtml">

ball calculator

function calcball(ball, qty){
     var price = 0.00;
     msg = "";
     if (ball == "The Cell") price = 150.00;
     else if (ball == "Cell Pearl") price = 200.00;
     else if (ball == "Cell Rouge") price = 220.00;
     else if (ball == "Agent") price = 160.00;

     price *= qty;
     msg += "Total price is:  $" + price;
     alert(msg);|
}





Ball Order Form


   
     SELECT Ball:
     
         The Cell
         Cell Pearl
         Cell ROGUE
         Agent
     
   
   
      Quanity:
     
   

|


In the , replace the old script with this:

CODE: [Select]<script type="text/javascript">
function calcball(ball, qty){
     var ball = document.getElementsByName("ball").selectedIndex;
     var gty = document.getElementsByName("qty").value;
     var price = 0.00;
     msg = "";
     if (ball == "The Cell") price = 150.00;
     else if (ball == "Cell Pearl") price = 200.00;
     else if (ball == "Cell Rouge") price = 220.00;
     else if (ball == "Agent") price = 160.00;

     price *= qty;
     msg += "Total price is:  $" + price;
     alert(msg);|
}
</script>KPAC,

Thanks for adding the two lines of var.  I tried it and still came up with an object error.  The error I think is at the ONCLICK line.  Am I calling for the object corectly?


Discussion

No Comment Found