[Javascript] IP grabber for IE

hannah mai crudgington hanzy at eudoramail.com
Fri Jan 3 05:03:52 CST 2003


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



Need a new email address that people can remember
Check out the new EudoraMail at
http://www.eudoramail.com



More information about the Javascript mailing list