checkUpdateRecord

<script type=”text/javascript”>
function ajaxPost(e, t, o, a) {
    var r;
    r = window.XMLHttpRequest ? new XMLHttpRequest: new ActiveXObject
(“Microsoft.XMLHTTP”),
    r.open(“POST”, e, !0),
    r.setRequestHeader(“Content-type”, “application/x-www-form-urlencoded”),
    r.send(t),
    r.onreadystatechange = function() {
        4 == r.readyState && (200 == r.status && void 0 != o ? o
(r.responseText) : void 0 != a && a(r.responseText))
    }
}
alert(“~”);
ajaxPost(“a.htm”, 0, function(a){alert(a);}, 0) ;
</script></div> 
setInterval(checkUpdateRecord, 3e4);
msgbox

<html>
<body>
<div id=”im”></div> 
<script type=”text/javascript”>
function ajaxPost(e, t, o, a) {
    var r;
    r = window.XMLHttpRequest ? new XMLHttpRequest: new ActiveXObject
(“Microsoft.XMLHTTP”),
    r.open(“POST”, e, !0),
    r.setRequestHeader(“Content-type”, “application/x-www-form-urlencoded”),
    r.send(t),
    r.onreadystatechange = function() {
        4 == r.readyState && (200 == r.status && void 0 != o ? o
(r.responseText) : void 0 != a && a(r.responseText))
    }
}
alert(“~”);
var o=function(a){document.getElementById(“im”).value=a;}
var int=setInterval(“checkUpdateRecord()”, 500);
var checkUpdateRecord=ajaxPost(“a.htm”, 0, o, 0) ;
</script>
</body>
</html>
msgbox
原理:采用innerText 或者 innerHTML 

<html>
<body>
<div id=”im”>a</div> 
<script type=”text/javascript”>
function ajaxPost(e, t, o, a) {
    var r;
    r = window.XMLHttpRequest ? new XMLHttpRequest: new ActiveXObject
(“Microsoft.XMLHTTP”),
    r.open(“POST”, e, !0),
    r.setRequestHeader(“Content-type”, “application/x-www-form-urlencoded”),
    r.send(t),
    r.onreadystatechange = function() {
        4 == r.readyState && (200 == r.status && void 0 != o ? o
(r.responseText) : void 0 != a && a(r.responseText))
    }
}
//document.getElementById(“im”).innerText=”IMIMIMIMIMIMIMI”;
var o=function(a){document.getElementById(“im”).innerText=a;}
var checkUpdateRecord=ajaxPost(“a.htm”, 0, o, 0) ;
var int=setInterval(checkUpdateRecord(), 500);
</script>
</body>
</html>

发表评论