Hi everyone, I am a new CF/HTML/JS learner. I am in the IT field but would like to expand my skill by doing something new so I thought I sign up for web development. I have a coworker who is very helpful and very knowledable in web all together. But I think I have asked him too much and would like to try a different avenue for help as I am learning. Plus, my coworker is on vacation so I have no one to bother about these questions I am looking to find out if it is possible to place an onClick on a checkbox? What I mean by this is before submiting the page, as soon as the user click on a checkbox, run the onClick event. Is that possible? If so, how? Thanks, cfnewb
<form method = "post" action = "http://www.example.com"> <input type = "checkbox" onclick = "alert('I am now selected!');"> <input type = "submit" value = "Submit"> </form> Code (markup): Is something like that what you're looking for?
rgchris, not exactly what I am looking for but thank you. So it is possible to place an onClick on a checkbox. Instead of the alert, I want to call a JS function. Here is a section of what I had coded for the two JS function (lots of missing code in between ofcourse): function verifyCheckbox3(form) { if (form.q4a[3].checked) { form.q4a[0].checked=false; form.q4a[1].checked=false; form.q4a[2].checked=false; return true; } } function verifyCheckbox2(form) { if (form.q4a[2].checked) { form.q4a[0].checked=false; form.q4a[1].checked=false; form.q4a[3].checked=false; return true; } } here is the checkbox section: <table> <tr> <td align=left><input type=checkbox name=q4a value=zero></td> <td><font size=2 face="Arial, Helvetica">checkbox zero</font></td> </tr> <tr> <td align=left><input type=checkbox name=q4a value=one></td> <td><font size=2 face="Arial, Helvetica">checkbox one</font></td> </tr> <tr> <td align=left><input type=checkbox name=q4a value=two></td> <td><font size=2 face="Arial, Helvetica">checkbox two</font></td> </tr> <tr> <td align=left><input type=checkbox name=q4a value=three></td> <td><font size=2 face="Arial, Helvetica">checkbox three</font></td> </tr> </table> How do I tie an onClick event on the checkbox to the JS function?
sure it would be just like this: <input type="checkbox" name="q4a" value="two" onClick="yourfunction(your, parameters);" /> Code (markup):
ah, I will look into this as well and see what works best. At my peon level, I am very happy that the possibility is there and that I found this forum. Thanks.