function LoadImage(ElementID, id) {
            //ElementID <img>的ID
            var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");  //WebClient
            if (!xmlhttp) {
                alert("創建xmlhttp對象異常");
                return false;
            }
            var url = "GetImage.ashx?ID=" + id + "&ts" + new Date();
            xmlhttp.open("POST", "GetImage.ashx?ID=" + id + "&ts" + new Date(), false);
            xmlhttp.onreadystatechange = function event() {
                if (xmlhttp.readystate == 4) {
                    if (xmlhttp.status == 200) {
                        document.getElementById(ElementID).src = url;
                    }
                    else {
                        alert("Ajax返回Error");
                    }
                }
            }
            xmlhttp.send();
        }

 

相关文章:

  • 2021-07-24
  • 2021-12-15
  • 2022-12-23
  • 2022-02-05
  • 2021-12-06
  • 2022-01-11
  • 2021-06-19
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-12
  • 2021-12-14
  • 2022-12-23
相关资源
相似解决方案