jaymc Posted July 22, 2007 Share Posted July 22, 2007 I want to be able to click anywhere in a <TD> to select or unselect a checkbox Here is some code Ive through together, it checks it but doesnt unselect OnClick="if(document.getElementsByName('list').checked='false'){document.getElementsByName('list').checked='true'} else if(document.getElementsByName('list').checked='true'){document.getElementsByName('list').checked='false'} Also, is there a better way in javascript to do this, at the moment Ive got this in every <TD> that has a checkbox Thanks Link to comment https://forums.phpfreaks.com/topic/61274-checkbox/ Share on other sites More sharing options...
jaymc Posted July 23, 2007 Author Share Posted July 23, 2007 Anyone? Link to comment https://forums.phpfreaks.com/topic/61274-checkbox/#findComment-305438 Share on other sites More sharing options...
nogray Posted July 23, 2007 Share Posted July 23, 2007 you can use this document.getElementsByName('list').checked = !document.getElementsByName('list').checked; or you can set a function to do to work by calling it with the id paramters onclick="check_box('list');" Link to comment https://forums.phpfreaks.com/topic/61274-checkbox/#findComment-305643 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.