clairian Posted March 20, 2008 Share Posted March 20, 2008 Hi, I am trying to use checkboxes so that when you select or deselect the checkbox it automatically sends the value (on/off) of that checkbox with a page refresh. However, at the moment (using the code below) when i check the box it refreshes the page with the value of property as 'on', but leaves the checkbox unchecked, so i can never deselect the checkbox to make the value of property 'off'. Any help would be greatly appreciated. $property = $_GET['property']; <form method="get" action="PropMain.php" name="Name"> <img src="MapsIcons/house.png" /> <input type="checkbox" name="property" onclick="checkHouse()"/> </form> function checkHouse() { if (Name.property.value != "") { Name.submit(); } } Quote Link to comment Share on other sites More sharing options...
zenag Posted March 27, 2008 Share Posted March 27, 2008 try this friend .... function checkHouse() { if(document.getElementById("property").checked==true) { alert('checked'); } if(document.getElementById("property").checked == false) { alert('not checked'); } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.