Ask a Question related to Macromedia Dynamic HTML, Design and Development.
-
LArtJunky #1
Adding to checkbox - javascript?
I have a product that can have 1 extra option
I want to be able to
Check boxes in form
O $20 for regular product
O Add $5 option (adds to $20 reg product price)
What's the best way to deal with this and what javascript would work for this?
LArtJunky Guest
-
Dynamic function or javascript to change checkbox tounchecked?
I am wondering if there is a ColdFusion function or maybe some simple javascript that can help me. I want to dynamically change a checkbox from... -
Adding a Blank Page with JavaScript
I'm being trying to add a blank page to an existing PDF document using JavaScript on Adobe Acrobat 5.0, unsuccessfully. I can insert a new... -
Find what checkbox is checked in javascript
I have to sets of checkboxes. The second is to delete the row. So when I click that checkbox I want to add it to an array. I also need to take it... -
adding multiple checkbox data to database
ok im new to this and have tried using a while loop adn a for loop to do it but cant get it to work, here is what i have, a registration page for... -
adding a checkbox to select the row.
i'm using c#. code behind if possible. i need a simple way to put a checkbox column in my datagrid and a button to see witch rows are selected...... -
-
John Doe #3
Re: Adding to checkbox - javascript?
LArtJunky wrote:
add an onClick handler for each checkbox:> I have a product that can have 1 extra option
> I want to be able to
>
> Check boxes in form
>
> O $20 for regular product
> O Add $5 option (adds to $20 reg product price)
>
> What's the best way to deal with this and what javascript would work for this?
<INPUT name='regular' type='checkbox' onClick='calcTotal(this.checked,
this.value)' value=20>
<INPUT name='option' type='checkbox' onClick='calcTotal(this.checked,
this.value)' value=5>
i assume you have a TOTAL field so, define a function to update it
anytime a user select/unselect an option:
<SCRIPT>
function calcTotal(cbStatus, idx) {
str = document.yourForm.totalField.value;
totalVar = parseFloat(str);
idxn = parseInt(idx, 10);
if (cbStatus) {
totalVar = totalVar + idxn;
} else {
totalVar = totalVar - idxn;
}
document.yourForm.totalField.value = totalVar.toString();
}
</SCRIPT>
not tested, post again if you hace any problem
hth,
jdoe
John Doe Guest



Reply With Quote

