not necessarily, you can define buttons using <button>, or you can write your script in a way, that it doesn’t matter. you may not even require a button.
radio or checkbox
Collapse
X
-
ok
My calculations are set with this code
will a click event change this?Code:function calculate(f) { var nums = f.num; var ntext = f.num; var result = 0; for(var i=0;i<nums.length;i++) { if(nums[i].checked) { result+=parseFloat(ntext[i].value); } } f.answer.value=Number(result).toFixed(2);Comment
-
Finally sorted the site out, dont know what happened there but i now have the following for my calculations
What i was thinking was could i have another function something like thisCode:function UpdateCost() { var sum = runtotal; var gn, elem; for (i=0; i<205; i++) { gn = 'id'+i; elem = document.getElementById(gn); if (elem.checked == true) { sum += Number(elem.value); } } parseFloat(sum); document.getElementById('total').value = sum.toFixed(2);
this is probably way too complicated and i know it wont workCode:function check() { var gn, elem; for (i=0; i<205; i++) { gn = 'id'+i; elem = document.getElementById(gn); if (elem.checked == true) then elem.checked == false else elemchecked==true } then call my calculate funtion }Comment
-
i seem to be getting there, i now have the following called by double click and this unchecks 1 radio and removes from the total, what i cant figure out is how to get this in a function that works on a single click
Code:function checkbutt(i) { var gn; gn = 'id'+i; { document.getElementById(gn).checked = false; } UpdateCost(); }Comment
Comment