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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.