Jump to content

InnerHTML fade on request?


matfish

Recommended Posts

Hi, I'm not great with Javascript/Ajax but I'v been using the below code in different places for a while now and it seems to work without any issues:

 

function showList(nodeID) {
	var xmlHttpReq = false;
	var self = this;
	var qstr = 'nodeID=' + (nodeID);

	document.getElementById('item_' + nodeID).innerHTML = "  <img src='/images/ajax_spinner_grey.gif' alt='Please wait.' border='0'> Loading...";


	if (window.XMLHttpRequest) {
		self.xmlHttpReq = new XMLHttpRequest();
	}else if (window.ActiveXObject) {
		self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
	}

	self.xmlHttpReq.open('POST', 'item_list.php', true);
	self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	self.xmlHttpReq.onreadystatechange = function() {
		if (self.xmlHttpReq.readyState == 4) {
			updatepage(self.xmlHttpReq.responseText, 'item_' + nodeID);
		}
	}


	self.xmlHttpReq.send(qstr);

}



function updatepage(str, div){
document.getElementById(div).innerHTML = str;
}

 

But I'm trying to fade the content which is updated in the .innerHTML so it looks a little "Flashy". Anyone have any ideas or point me in the right direction?

 

Many 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.