By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,292 Members | 1,514 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,292 IT Pros & Developers. It's quick & easy.

question REMOTE_ADDR

P: n/a
Hi,

The javascript in my page is not working, itstead of alerting me the ip
address, it alerts me with string "<!--#echo var="REMOTE_ADDR"-->".

var ip = '<!--#echo var="REMOTE_ADDR"-->';
alert("Your IP address is "+ip);

How do I fix the problem?
Thanks.

Jason
Jul 23 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
In <ci**********@news.seed.net.tw> Jason wrote:
Hi,

The javascript in my page is not working, itstead of alerting me the
ip address, it alerts me with string "<!--#echo var="REMOTE_ADDR"-->".

var ip = '<!--#echo var="REMOTE_ADDR"-->';
alert("Your IP address is "+ip);

How do I fix the problem?
Thanks.

Jason


Your JS is incorrect. Try here for an example of how to do what you
want:

http://javascript.internet.com/user-...p-address.html

As a tip for the future, if you want to do anything in JavaScript, go to
Google and put in something like:

javascript get IP address

That's exactly what I did to get the above. Then, when you have
something that is nearly working, come here and you will get very good
advice.

Cheers, Fred
Jul 23 '05 #2

P: n/a
Thanks Fred,

I did the same google search and visited the site you talked about, but it's
just not working.
Thanks anyway.

Jason

"Fred Oz" <oz****@iinet.net.smudge> bl
news:20********************@freenews.iinet.net.au g...
In <ci**********@news.seed.net.tw> Jason wrote:
Hi,

The javascript in my page is not working, itstead of alerting me the
ip address, it alerts me with string "<!--#echo var="REMOTE_ADDR"-->".

var ip = '<!--#echo var="REMOTE_ADDR"-->';
alert("Your IP address is "+ip);

How do I fix the problem?
Thanks.

Jason


Your JS is incorrect. Try here for an example of how to do what you
want:

http://javascript.internet.com/user-...p-address.html

As a tip for the future, if you want to do anything in JavaScript, go to
Google and put in something like:

javascript get IP address

That's exactly what I did to get the above. Then, when you have
something that is nearly working, come here and you will get very good
advice.

Cheers, Fred

Jul 23 '05 #3

P: n/a
Please do not top-post Jason,
I find it most confusing..
<http://www.physci.org/codes/javafaq.jsp#netiquette>

See further comments in-line..

On Wed, 15 Sep 2004 16:36:17 +0800, Jason wrote:
"Fred Oz" <oz****@iinet.net.smudge> ...
In <ci**********@news.seed.net.tw> Jason wrote: ...
The javascript in my page is not working, itstead of alerting me the
ip address, it alerts me with string "<!--#echo var="REMOTE_ADDR"-->".
... http://javascript.internet.com/user-...p-address.html
... I ...visited the site you talked about, but it's
just not working.


Did you try flogging it Jason?
It may just be lazy.

Or to put that another way, what the heck
is 'just not working' supposed to mean?

Did you get an error page? A blank
browser window with no further information?
A web-page with text that seemed unrelated?

I tried the page myself. It popped up an
alert when arriving at the page that read
'Your IP address is nnn.nn.nn.nn'
Where all the 'n's were digits.

Once I dismissed the alert, I saw the page itself,
which has a text area with a script in it.

Did you get those?

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Jul 23 '05 #4

P: n/a
Lee
Jason said:

Hi,

The javascript in my page is not working, itstead of alerting me the ip
address, it alerts me with string "<!--#echo var="REMOTE_ADDR"-->".

var ip = '<!--#echo var="REMOTE_ADDR"-->';
alert("Your IP address is "+ip);


That's not a Javascript problem. That script relies upon your web
server being configured to replace the text inside the single-quotes
with the user's IP address.

Even when that "works", it doesn't provide useful information in
many cases, because dial-up users may have a different IP address
each time they connect, and many other users may be behind proxies
so that hundreds of machines will all report the same IP address.

Jul 23 '05 #5

P: n/a
In <ci**********@news.seed.net.tw> Jason wrote:
Thanks Fred,

I did the same google search and visited the site you talked about,
but it's just not working. Thanks anyway.


Jason, there's some pointers here:

http://reglos.de/myaddress/MyAddress.html

Cheers.
Jul 23 '05 #6

P: n/a
Fred Oz wrote:
In <ci**********@news.seed.net.tw> Jason wrote:
The javascript in my page is not working, itstead of alerting me the
ip address, it alerts me with string "<!--#echo var="REMOTE_ADDR"-->".

var ip = '<!--#echo var="REMOTE_ADDR"-->';
alert("Your IP address is "+ip);

How do I fix the problem?


Your JS is incorrect.


Nonsense. The client-side JS code is syntactically absolutely correct.
However, this solution also requires server-side includes which are
obviously not working properly.

And please trim your quotes to the absolute necessary.
PointedEars
Jul 23 '05 #7

P: n/a
In article <19****************@PointedEars.de>,
Thomas 'PointedEars' Lahn <Po*********@web.de> wrote:
However, this solution also requires server-side includes which are
obviously not working properly.


I was wondering how this code worked. Thanks.

Robert
Jul 23 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.