hithis function is working alright but i want to display the output in the ex-vat textbox instead of a window prompt.HOW DO I DO IT?????here is the script fot yethanks in advanceconfused man
<script>--> function Calculate() { var cost=0; if (document.ConsultantForm.Consultant[0].checked==true) //Document Object Model (DOM) address cost = 1200; else cost = 1000; if(document.ConsultantForm.phone.checked==true) cost = cost + 45; if(document.ConsultantForm.visit.checked==true) cost = cost + 225; DisplayPrice(cost); } //End of Calculate – ALL local vars e.g. cost are distroyed function DisplayPrice(y) { alert("Consultant price: "+ y +" Euro"); } //End of DisplayPrice – parm var y is distroyed // --> </script></head><body> <form name=ConsultantForm> <table border="1"> <tr> <th>DESCRIPTION</th> <th>COST</th> </tr> <tr> <td><input type="radio" name="Consultant" value="A" checked>Senior Consultant</td> <td>1200 Euro</td> </tr> <tr> <td><input type="radio" name="Consultant" value="B">Junior Consultant</td> <td>1000 Euro</td> </tr> <tr> <td><input type="checkbox" name="phone">Immediate Phone Consultation</td> <td>45 Euro</td> </tr> <tr> <td><input type="checkbox" name="visit">Next day onsite visit</td> <td>225 Euro</td> </tr> <tr> <td>Price(ex VAT)</td> <td><input type="textbox" name="ex-vat" > </td> </tr> <tr> <td>Total Price </td> <td><input type="textbox" name="total-vat"></td> </tr> </table> </form> <center> <input type="button" onClick="Calculate()" value="Calculate Consultants Price" name="calc"> <input type="button" onClick="Clear()" value="Clear Current Selections" name="clear"> <input type="button" onClick="Database()" value="Submit to database" name="Submit"> </center> </center> </BODY></body></html>