SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: Coookies
-
Nov 11, 2004, 09:48 #1
- Join Date
- Nov 2004
- Location
- euston
- Posts
- 1
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Coookies
Help please! I need to set up a cookie that will do something similar to this:
When a new user hits the my homepage (index.htm) a pop-up window will open automatically with a survey in it. Once the user completes the survey and hits the submit button the window goes away. Then the next time that particular user hits that same index.htm page again the cookie realises that this user has already completed that form and does not show the pop-up. If a user just closes the window without submitting, the popup will continue to open with the homepage.
I'm very new to this, if someone could help me, I'd be very gratful
K.
-
Nov 11, 2004, 11:23 #2
Hello
This should probably be in the javascript forum but here is a link that may help: http://javascript.internet.com/cooki...opup-once.html
Hope it helps
later
Johnny
-
Nov 11, 2004, 13:03 #3
- Join Date
- Mar 2001
- Posts
- 3,537
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
main_page.htm:
Code://in response to some event, like 'onload' call this function: <script> window.onload = openPopUpWithSurvey; function openPopUpWithSurvey() { var theVarIPutInTheCookie = //read cookie value; if (theVarIPutInTheCookie != "already completed the survey") { window.open("my_form.htm", ......); } } </script> </head>
Code:<script> function set_cookie() { //set a cookie; } </script> </head> <body> <form ....onsubmit='set_cookie()' ...> ... ... </form> </body>
http://www.elated.com/tutorials/prog...cript/cookies/
http://www.quirksmode.org/js/cookies.html
Bookmarks