其他分享
首页 > 其他分享> > js获取源代码

js获取源代码

作者:互联网

<!DOCTYPE html>
<html>
<head>
<title>get Ip and MAC!</title>
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
</head>
<body>
<script type="text/javascript">
 var xhr = new XMLHttpRequest(); 
     xhr.open("get","http://myip.ipip.net",true); 
     xhr.send(); 
     xhr.onreadystatechange = function(){ 
         if (xhr.readyState == 4) { 
             if (xhr.status>=200 && xhr.status<300) { 
                 alert(xhr.responseText); 
             }; 
         }; 
     } 
</script>
</body>
</html>

 

 

 

<!DOCTYPE html>
<html>
<head>
<title>get Ip and MAC!</title>
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
</head>
<body>

<script src="./js/jquery.js"></script> <!-- jquery-->
<script type="text/javascript">
$.get("http://myip.ipip.net",null,function(res){
        console.log(res);
    });
</script>
</body>
</html>

 

标签:status,get,res,myip,js,xhr,获取,net,源代码
来源: https://www.cnblogs.com/Galesaur-wcy/p/15022875.html