View Full Version : javascript help
razor
May 1st, 2001, 15:12
can anyone write a simple javascript that when someone leaves my website or closes the window, it will automatically delete a cookie which has been set by php.
lucifer
May 2nd, 2001, 11:21
if they leave your site there's nothing you can do. on window close you could run some javascript
if you want something like this don't use a cookie either use a session variable on the links mypage.php3?session=xxx or as a hidden form field to keep track of the user or the php built in stuff
razor
May 2nd, 2001, 15:35
how do i use a hidden form field without using a button though?
RedHat
May 3rd, 2001, 14:02
Originally posted by razor
how do i use a hidden form field without using a button though?
<input type=hidden name=namer>
Right ?
lucifer
May 3rd, 2001, 16:59
what are you trying to do?
maybe it's easiest to just give the cookie an expiry date of say one hour.
if your not using a form use 'get' notation
mypage.php3?var=xxxxx
but you need to add ?var=xxxxx to all your links plus they must all be executable. This don't work for forms which is why var=xxxx has to be in the hidden field
session tracking is fun ;) but best avoided if you can.
Gonzo
May 3rd, 2001, 18:02
Don't set a expier date for the cookie and the cookie will delete it self as soon as the browser is closed.
razor
May 4th, 2001, 06:00
actually i made the cookie expire in an hour, i just wanted to see how the form thing would work. . .
internetsparadise
May 4th, 2001, 20:15
the best place to find javascript is http://www.javascriptsource.com try it thats where I find alot of my scripts
Powered by vBulletin® Version 4.1.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.