I want 15% discount to be displayed automatically on the webpage once the user selects SE15 as the discount code(when the function is called)
this is the code i have, its not working, what could be the problem
<script type="text/javascript">
function getDiscount(){
var discount_code=document.orders.discount_code.options[document.orders.discount_code.selectedIndex].value;
var discount=document.orders.discount.options[document.orders.discount.selectedIndex].value;
var answer=document.orders.answer.value;
if(discount_code=="SE15")
discount=answer-(answer/100*15)
else
discount=0
document.orders.answer.value= "$ " + discount
}
</script>