I have check boxes that get generated dynamically, when the check box is checked the onchange method works fine and my function is called also when the box is unchecked by user the onchange method calls my intended function the problem is when the box is checked a part of the page becomes active which is good but when the user un-checks the checkbox the that part of the page becomes active again, and the value of the checkbox "checked " stays yes after the first time it was checked. Is there way to detect when the user choose to un-check so the active part of the page becomes inactive.
Could I send the check box status with out having submit in the form. Does it have to be submitted for post to work. Do I have to use Java script for this ?
I tried this i'm having issues
<script type="text/jscript">
//this funciton will be called when user checks a check box.
function edit(){
//get selected category from the form
//var formName = 'choose';
//var Category = document[formName]['choose'].value;
//check if browser suports ajax
var xmlhttp = null;
if(typeof XMLHttpRequest != 'udefined'){
xmlhttp = new XMLHttpRequest();
}
else if(typeof ActiveXObject != 'undefined'){
xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
}
else
throw new Error('You browser doesn\'t support ajax');
//open connection with activateImages.php to recieve the active images as an acho
xmlhttp.open("GET", "activateImages.php",true);
//echeck if ready to recieve
xmlhttp.onreadystatechange = function (){
if(xmlhttp.readyState == 4)
window.activate(xmlhttp);
};
xmlhttp.send(null);
}
//recieve the active images then insert them in the specified location of the page.
function activate(xhr){
if(xhr.status == 200){
document.getElementById('images').innerHTML = xhr.responseText;
}
else
throw new Error('Server has encountered an error\n'+
'Error code = '+xhr.status);
}
</script>