66420b16880e7505050a2945cc43fde775413ada.svn-base 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. var XMLHttpReq;
  2. var currentSort;
  3. // ����XMLHttpRequest����
  4. function createXMLHttpRequest() {
  5. if (window.XMLHttpRequest) {
  6. XMLHttpReq = new XMLHttpRequest();
  7. } else if (window.ActiveXObject) {
  8. try {
  9. XMLHttpReq = new ActiveXObject("Msxml2.XMLHTTP");
  10. } catch (e) {
  11. try {
  12. XMLHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
  13. } catch (e) {
  14. }
  15. }
  16. }
  17. }
  18. // ����������
  19. function sendRequest(url) {
  20. createXMLHttpRequest();
  21. XMLHttpReq.open("GET", url, true);
  22. XMLHttpReq.onreadystatechange = processResponse;
  23. XMLHttpReq.send(null);
  24. }
  25. // ���?����Ϣ����
  26. function processResponse() {
  27. if (XMLHttpReq.readyState == 4) {
  28. if (XMLHttpReq.status == 200) {
  29. updateMenu();
  30. } else {
  31. alert("���������ҳ�����쳣��");
  32. }
  33. }
  34. }
  35. /**
  36. * @gettype :all ���б����ֶ� constant ֻȡ�����ֶ� date ֻȡ���������ֶ� text
  37. * ������ͨ�����ı���¼����ֶ�
  38. */
  39. function getTable(obj, selectName, gettype) {
  40. if (obj.value == "")
  41. return;
  42. var strA = "";
  43. createXMLHttpRequest();
  44. axo = new ActiveXObject("Microsoft.XMLDOM");
  45. XMLHttpReq.open("POST", "getAttributeXml.jsp?classid=" + obj.getValue()
  46. + "&gettype=" + gettype, false);
  47. XMLHttpReq.setRequestHeader("Content-Length", strA.length);
  48. XMLHttpReq.setRequestHeader("Content-type",
  49. "application/x-www-form-urlencoded");
  50. XMLHttpReq.send(strA);
  51. axo.loadXML(XMLHttpReq.responseText);
  52. n1 = axo.selectNodes("/root/name");
  53. n2 = axo.selectNodes("/root/description");
  54. BuildSel(unescape(XMLHttpReq.responseText), selectName, n1, n2);
  55. }
  56. function BuildSel(str, sel, id, name) {
  57. sel.options.length = 0;
  58. if (id.length == 0) {
  59. sel.options[sel.options.length] = new Option('')
  60. return;
  61. }
  62. var arrstr = new Array();
  63. arrstr = str.split(",");
  64. sel.options[sel.options.length] = new Option('-��ѡ��-');
  65. // ��ʼ�����µ�Select.
  66. for (var i = 0; i < id.length; i++) {
  67. sel.options[sel.options.length] = new Option(name(i).text, id(i).text);
  68. }
  69. }