I recently found the following JavaScript code which is supposed to let one
find then use the ip address of the person accessing the web page containing
the script.
<SCRIPT LANGUAGE="JavaScript">
<!--
var ip = '<!--#echo var="REMOTE_ADDR"-->';
function ipval() {
document.myform.ipadd.value=ip;
}
window.onload=ipval
// -->
</script>
There are various forms of this code which displays the ip address in an
alert box, in a text box in a form, etc but none work for me. When I access
a page with the above in it (along with the appropriate text box in the body
of the page) nothing happens. However, when I view the source of the page
with the browser view item, the source of the page appears with the line
var ip = '<!--#echo var="REMOTE_ADDR"-->';
replaced by the appropriate ip address followed by a ';. The var ip = just
disappeared and the variable ip is not set to anything. I would like the
variable ip set to the address so that I can then do some processing with
it.
Can someone explain what is happening and how I can get this code to work?
Thank you.
Doug van Vianen
if********@shaw.ca