Ajax功能在任何IE版本中都不起作用

时间:2013-04-08 21:04:42

标签: javascript ajax

//Ajax Functions
<script language="javascript">
  function ajaxFunction(item) {
    var type;
    try {
      type = new XMLHttpRequest();
    }
    catch (f) {
      try {
        //xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        type = new ActiveXObject("Msxml2.XMLHTTP");
      }
      catch (f) {
        try {
          type = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (f) {
          alert("Your browser does not support AJAX!");
          return false;
        }
      }
    }
    type.onreadystatechange = function () {
      if (type.readyState == 4) {
        document.getElementById('type_div').innerHTML = type.responseText;
      }
    }
    type.open("POST", 'get_type.php?f=' + item, true);
    type.send(null);
  } 
< /script>

0 个答案:

没有答案