Computing.Net > Forums > Programming > java script help

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

java script help

Reply to Message Icon

Name: Tim
Date: August 13, 2002 at 23:33:13 Pacific
Comment:

can some won please help me out with this script im trying to get it to save the viewers current ip address to there own hard drive as a cookie it does not need to be retreved just stored for the current sesion and the renew the next time the viewer vists the web page heres the script I had to leave part of the script tags out but youll get the idea Thanks for your time.........
//html
//head
//body
//script language="javascript"

/expireDate = new Date
/expireDate.setMonth(expireDate.getMonth())

///head


/var ip = ''

/function ipval() {
/document.myform.ipaddr.value=ip;
/}
/window.onload=ipval
//script

/form method="post" action="" name="myform">
/
//form
/script

/ipAddr = ""
/if (document.cookie != "") {
/ipAddr = document.cookie.split("=")[1]
/}

/function setCookie() {
/ipAddr = document.myForm.nameField.value
/document.cookie = "ipAddr="+ipAddr+";expires=" + expireDate.toGMTString()
/}
/onLoad="setCookie"=document.myForm.nameField.value = ipAddr"

//script
//body
//html




Sponsored Link
Ads by Google

Response Number 1
Name: muska
Date: August 16, 2002 at 18:42:20 Pacific
Reply:

Hello there,

As far as my experience goes, I haven't been successful in retreiving a user's IP address. If so, you could record it in a cookie file, but getting it is the problem. Go here for a set of cookie functions if you need them.


0

Response Number 2
Name: Tim
Date: August 17, 2002 at 23:12:55 Pacific
Reply:

getting the ip address is the easy part i just cant figure out the cookie part thanks for the link Tim


0

Response Number 3
Name: muska
Date: August 18, 2002 at 06:47:00 Pacific
Reply:

How do you get the IP address with JavaScript?


0

Response Number 4
Name: Tim
Date: August 18, 2002 at 22:44:56 Pacific
Reply:

here you go can you send that link again? The one above does not work Thanks!!
oh ya uncomment all the lines before you try to use it..
//

//var ip = ''

//function ipval() {
//document.myform.ipaddr.value=ip;
//}
//window.onload=ipval
//

//
//
//


0

Response Number 5
Name: Tim
Date: August 18, 2002 at 22:51:17 Pacific
Reply:

Send me your email address it will not let me post it here it keeps cuting parts of it out, when i try to post it. Also will you resend that link the one above does not work thanks Tim


0

Related Posts

See More



Response Number 6
Name: muska
Date: August 21, 2002 at 15:40:54 Pacific
Reply:

Sorry bout that, here is the link.

My email address is above. Send the script if you need.


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: java script help

java script help www.computing.net/answers/programming/java-script-help/2427.html

Using Java Script to write to a tex www.computing.net/answers/programming/using-java-script-to-write-to-a-tex/3283.html

Java script problem www.computing.net/answers/programming/java-script-problem/2048.html