Welcome visitor
* Login
* Register
It is currently September 15th, 2019, 9:59 pm
All times are UTC [ DST ]
* Search
View unanswered posts - View active topics

FORUMS » Client Side » JavaScript



Post new topic Reply to topic  [ 2 posts ] 
Author Message
  add tax with a checkbox
PostPosted: August 13th, 2009, 6:50 am 

Posts: 19
i have a checkbox that will add the tax to the sum of some inputs, so it will only add the tax when it is checked, do you know how to do it? would you like to help me, please?


Top
 Profile  
 
  Re: add tax with a checkbox
PostPosted: August 13th, 2009, 7:03 am 

Posts: 117
Because you didn't provide any code I made some assumptions, like "totalSumNumber" being a variable with the total of the sum before the tax is added, or "total" being an input where the total is displayed. Nevertheless, I hope this helps.
<input type="checkbox" value=".0786" name="tax" 
onclick="t=document.getElementById('total');x=Number(t.value);
if(this.checked){y=x+x*this.value;t.value=y;}
else{t.value=totalSumNumber;}" />


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

FORUMS » Client Side » JavaScript


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron