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>