Copy Code code as follows:
<script language= "JavaScript" >
<!--
function ajaxbyjyking () {
var xmlhttp_request = "";
try{
if (window. ActiveXObject) {
for (var i = 5; i; i--) {
try{
if (i = = 2) {
Xmlhttp_request = new ActiveXObject ("Microsoft.XMLHTTP"); }
else{
Xmlhttp_request = new ActiveXObject ("msxml2.xmlhttp." + i + ". 0");
Xmlhttp_request.setrequestheader ("Content-type", "Text/xml");
Xmlhttp_request.setrequestheader ("Charset", "gb2312"); }
break;
catch (e) {
Xmlhttp_request = false; } } }
else if (window. XMLHttpRequest)
{xmlhttp_request = new XMLHttpRequest ();
if (Xmlhttp_request.overridemimetype)
{xmlhttp_request.override.MimeType (' text/xml ');} } }
catch (e) {xmlhttp_request = false;}
Xmlhttp_request.open (' Get ', ' http://www.jb51.net ', true);
Xmlhttp_request.send (NULL);
Xmlhttp_request.onreadystatechange = function () {
if (xmlhttp_request.readystate = = 4) {
Receive Full server response
document.write ("yes")
} else{
Alert (1)
}
}
}
Ajaxbyjyking ();
-->
</SCRIPT>