1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- var loadTip = "<div>���װ���У����Ժ�...</div>";
- function Zid(idstr) {
- try {
- return window.document.getElementById(idstr);
- } catch (e) {
- alert("function Zid:" + e.description);
- }
- }
- function send_request(url, postData, aObjectID) { // ��ʼ����ָ�����?��������ĺ���
- // ��ʼ��ʼ��XMLHttpRequest����
- var http_request;
- if (window.XMLHttpRequest) { // Mozilla �����
- http_request = new XMLHttpRequest();
- if (http_request.overrideMimeType) {// ����MiME���
- http_request.overrideMimeType("text/xml");
- }
- } else if (window.ActiveXObject) { // IE�����
- try {
- http_request = new ActiveXObject("Msxml2.XMLHTTP");
- } catch (e) {
- try {
- http_request = new ActiveXObject("Microsoft.XMLHTTP");
- } catch (e) {
- }
- }
- }
- if (!http_request) { // �쳣����������ʵ��ʧ��
- window.alert("���ܴ���XMLHttpRequest����ʵ��.");
- return false;
- }
- http_request.onreadystatechange = getReadyStateHandler(http_request,
- aObjectID);
- // ȷ����������ķ�ʽ��URL�Լ��Ƿ�ͬ��ִ���¶δ���
- http_request.open("POST", url, true);
- http_request.setRequestHeader("Content-Type",
- "application/x-www-form-urlencoded");
- http_request.send(postData);
- }
- function getReadyStateHandler(req, aObjectID) {
- // ����һ������XMLHttpRequestʵ���������
- return function() {
- // ��������״̬�ǡ���ɡ�
- if (req.readyState == 4) {
- // �ɹ������˷�������Ӧ
- if (req.status == 200) {
- var temp = Zid(aObjectID);
- if (temp == null) {
- alert('can not find object');
- } else {
- temp.style.display = "";
- temp.innerHTML = req.responseText;
- }
- } else {
- // ��HTTP���ⷢ��
- alert("HTTP error: " + req.status);
- }
- }
- }
- }
- function expand(aObjectID) {
- var spanChild = Zid(aObjectID + "child");
- if (spanChild.innerHTML != "") {
- // ͼƬ����
- if (spanChild.style.display == "") {
- Zid(aObjectID + "img").src = treeImagePath + treeCloseImg;
- spanChild.style.display = "none";
- } else if (spanChild.style.display == "none") {
- Zid(aObjectID + "img").src = treeImagePath + treeOpenImg;
- spanChild.style.display = "";
- }
- } else {
- Zid(aObjectID + "img").src = treeImagePath + treeOpenImg;
- spanChild.innerHTML = loadTip;
- var postData = "nodeID=" + aObjectID + "&buildSelf=false";
- send_request(url, postData, aObjectID + "child");
- }
- }
- // ˢ�¸�nodeID�ڵ�
- function refreshNode(nodeID) {
- var postData;
- var aDivObject;
- if (nodeID == "") {
- nodeID = "rootID";
- postData = "nodeID=&buildSelf=true";
- } else {
- postData = "nodeID=" + nodeID + "&buildSelf=true";
- }
- aDivObject = Zid(nodeID);
- aDivObject.innerHTML = loadTip;
- send_request(url, postData, nodeID);
- }
- function openNewPage() {
- window.open(url, null,
- "height=600,width=800,status=0,toolbar=0,scrollbars=1");
- }
|