Login   Register  
PHP Classes
elePHPant
Icontem

File: javascript/tree.js

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Roberto M.  >  Tree AJAX  >  javascript/tree.js  >  Download  
File: javascript/tree.js
Role: Auxiliary data
Content type: text/plain
Description: Funtion that show/hide layers and call the Ajax object
Class: Tree AJAX
Show a tree of nodes opened dynamically with AJAX
Author: By
Last change:
Date: 7 years ago
Size: 917 bytes
 

Contents

Class file image Download
		//<![CDATA[

		// Funtion that show/hide layers and call the Ajax object
		function loadTree(id){
			if (document.getElementById("c"+id).style.display=="none"){
				document.getElementById("c"+id).style.display="inline";

			if(document.getElementById("c"+id).innerHTML == ""){
				document.getElementById("c"+id).innerHTML="loading...";  // place to insert a preloading icon .... web2.0 like

				target = document.getElementById("c"+id);
				var myConn = new XHConn();
				if (!myConn) alert("XMLHTTP not available. Try a newer/better browser.");
				myConn.connect("tree_sub.php", "POST", "id="+id, showTree);
				}
			} else {
				document.getElementById("c"+id).style.display="none";
				}
		}

		// Funtion whenDone XHConn is complete
		showTree = function(oXML) {
			target.innerHTML = oXML.responseText;
			if(oXML.responseText == "")
				target.style.display="none";
		}

		//]]>