Home >Web Front-end >JS Tutorial >Summary of methods to obtain IP address using js_javascript skills

Summary of methods to obtain IP address using js_javascript skills

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 16:42:382021browse

1. Method 1 of obtaining IP address using js

<script src="http://pv.sohu.com/cityjson&#63;ie=utf-8"></script> 
<script type="text/<A class=infotextkey href="http://www.jb51.net/" target=_blank>javascript</A>"> 
document.write(returnCitySN["cip"]+','+returnCitySN["cname"]) 
</script>

2, Method 2 of obtaining IP address using js

<script language="javascript" type="text/javascript" src="http://fw.qq.com/ipaddress"> 
</script>  
 <script>document.write("你的IP是:"+IPData[0]+",来自:"+IPData[2]); 
</script>

3. Method 3 of obtaining IP address with js, Tencent IP, convert to UTF-8:

<script type="text/javascript" src="http://fw.qq.com/ipaddress" charset="gb2312"></script>
$(document).ready(function() { 
  $("#ip").val(IPData[0]); 
  $("#add").val(IPData[2]); 
})
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn