I am not sure how to put the code into this post so i will have to do it direct
I have a little problem here.
Using onClick
On a checkbox wrapped in a div I have an onClick event in the checkbox which changes it from unChecked to Checked and this works fine and it change the checkbox propertes from
You just want to call one or the other function when the checkbox is ticked or not.
How about:
<input type="checkbox" onChange="changeContent('vadiv');" value="'value'" id="vbook'" name="vbook"/>
function changeContent(id){
if(document.getEmelentById('vook').checked=='checked'){
//what need to be accomplished if box ticked
...
}
else{
//what need to be accomplished if checkbox is unticked
...
}
}
I see no reason to use two functions changeContentA and changeContentB to change the content of the element "vadiv" into another checkbox.
Hi holyhttp
That makes sense, I will give that a try later today. I think i will also need to include Ajax as when a check box is ticked it will also need to update a value in a box. I am sure there is a Javascript for that one which I have used before. One box is the total and all others will be prices and as they tick certain boxes or remove ticks the total changes.
Bookmarks