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>

 

posted @ 2021-07-17 10:51  冰糖葫芦很乖  阅读(306)  评论(0编辑  收藏  举报