Jump to content

putting a checkbox toggle into getXMLHttp...


glennn.php

Recommended Posts

I'm doing a little stovetop experimentation (i know very little about AJAX) and i'm trying to get the latter function toggle_acuras() (toggled by a checkbox, obviously) merged with this AJAX getXMLHttp function. can someone help me with this?

 

 

<script type="text/javascript">
function getXMLHttp() {
var xmlHttp;
try { xmlHttp = new XMLHttpRequest(); }
catch(e) {
	try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); }
	catch(e) {
		try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); }
		catch(e) {
			alert("Your browser does not support AJAX!");
			return false;
		}
	}
}
return xmlHttp;
}

function refreshIt(divID, MyPage) {
xmlHttp = getXMLHttp();
xmlHttp.onreadystatechange = function(){
	if(xmlHttp.readyState == 4) { setInnerText(divID, xmlHttp.responseText); }
}
xmlHttp.open("GET", MyPage, true);
xmlHttp.overrideMimeType("text/html; charset=ISO-8859-1");
xmlHttp.send(null);
return false;
}


function setInnerText(divID, response){
var el = (document.getElementById) ? document.getElementById(divID) : document.all[divID];
if(el) { el.innerHTML = response; }
}
/*******************************************/

function toggle_acuras()
{ 
var form   = document.getElementById('Acura'); 
var thanks = document.getElementById('Acura1'); 
((form.checked)? Acura1.style.display='block': Acura1.style.display='none');
} 

</script>

 

thanks much!!

 

or even someone could show me how to toggle a <?php include() ?> with a checkbox; which is all i'm trying to do with about 45 checkboxes...

 

that'd even be better.

 

thanks

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.