- 论坛徽章:
- 0
|
javascript中能否得到客户端ip呢
This script displays the user's IP address in the title bar, status bar, and/or an alert box.
- <!-- ONE STEP TO INSTALL IP ADDRESS:
- 1. Copy the coding into the HEAD of your HTML document -->;
- <!-- STEP ONE: Paste this code into the HEAD of your HTML document -->;
- <HEAD>;
- <SCRIPT LANGUAGE="JavaScript">;
- <!-- This script and many more are available free online at -->;
- <!-- The JavaScript Source!! http://javascript.internet.com -->;
- <!-- Begin
- // http://www.kdcgrohl.com
- // Depending on your server set-up,
- // you may need to use the ".shtml"
- // extension [instead of the "html"
- // or "htm"] as the script uses Server
- // Side Includes. To display in the
- // title bar, exclude the
- //"<title>;</title>;" code from the page.
- // This part gets the IP
- var ip = '<!--#echo var="REMOTE_ADDR"-->;';
- // This part is for an alert box
- alert("Your IP address is "+ip);
- // This part is for the status bar
- window.defaultStatus = "Your IP address is "+ip;
- // This part is for the title bar
- document.write("<title>;Your IP address is "+ip+"</title>;");
- // End -->;
- </script>;
- <p>;<center>;
- <font face="arial, helvetica" size"-2">;Free JavaScripts provided<br>;
- by <a href="http://javascriptsource.com">;The JavaScript Source</a>;</font>;
- </center>;<p>;
- <!-- Script Size: 1.09 KB -->;
复制代码 |
|