[Javascript] IP grabber for IE

Peter Brunone peter at brunone.com
Fri Jan 3 10:39:39 CST 2003


Hannah,

   You need to find out what kinds of scripting languages are supported by your server.  The line

<!--#echo var="REMOTE_ADDR"-->

is a server-side command (possibly Perl, but I'm not sure).  To get the IP address, you'll want to use ASP, Perl, PHP, or something similar;  once you know what you have available, it's really easy to do.

Cheers,

Peter

---------- Original Message ----------------------------------
From: "hannah mai crudgington" <hanzy at eudoramail.com>
Reply-To: javascript at LaTech.edu
Date: Fri, 03 Jan 2003 03:03:52 -0800

>Dear All,
>
>I'm a bit of a beginner.. I've been asked to write a page for work, so that we can extract useful user information, for example their IP address, so that they don't have to go to start/run/cmd/ ipconfig.
>
>I've found some code that does this, but I can't get it to work..
>
>Here's the code:
>
>
><script language="javascript">
>
>var ip = '<!--#echo var="REMOTE_ADDR"-->'
>
>function ipval() {
>document.myform.ipaddr.value=ip;
>}
>window.onload=ipval
></script>
>
><form method="post" action="" name="myform">
>  <input type="text" name="ipaddr" readonly>
></form>
>
>I've saved the page as .SHTML, as its using SSI. Also, I've put the script in the body of the html.
>
>I know that the problem relates to the line
>
>var IP + '<!--#echo var="REMOTE_ADDR"-->'
>
>As this is what ends up being printed in the box.
>
>How do I make this script work?
>
>Many thanks
>
>Hannah
>



More information about the Javascript mailing list