Freelancers Network
 
skill list top cap
Homepage
Join the Freelancer's Network
Update your details
Find a freelancer
Post a project
Find a project
Projects Archive
Post a job
Find a job
Jobs Archive
See Dan's Pages
See Andy's Pages
Link to this site
Resources
Join/Leave Forum
Forum Messages
+Additions+ Adverts
Advertising
Contact Us
Subscribe to our newsletter - enter your email address and hit return
Freelancers.net is owned and operated by Andy Stowell and Dan Winchester
skill list end cap
guru web hostcom

Find me again on Freelancers.net

RE: FN-FORUM frame jammin

date posted 1st May 2001 08:34

>>Oh by the way you wouldn't know how to get a input text box to
>>display info
>>from a cookie.



This is what your looing for ?
(sorry its lost the formating though ;-(



dec

Using Cookies: an Example
Using the cookie functions defined in the previous section, you can create a
simple page users can fill in to "register" when they visit your page. If
they return to your page within a year, they will see a personal greeting.


The following function returns a cookie value, given the name of the cookie:

function getCookie(Name) { var search = Name + "=" if
(document.cookie.length > 0) { // if there are any cookies offset =
document.cookie.indexOf(search) if (offset != -1) { // if cookie
exists offset += search.length // set index of beginning
of value end = document.cookie.indexOf(";", offset) // set
index of end of cookie value if (end == -1) end =
document.cookie.length return
unescape(document.cookie.substring(offset, end)) } }}


You need to define one additional function in the HEAD of the document. This
function, register, creates a cookie with the name TheCoolJavaScriptPage and
the value passed to it as an argument.

function register(name) { var today = new Date() var expires = new
Date() expires.setTime(today.getTime() + 1000*60*60*24*365)
setCookie("TheCoolJavaScriptPage", name, expires)}

The BODY of the document uses getCookie (defined in the previous section) to
check whether the cookie for TheCoolJavaScriptPage exists and displays a
greeting if it does. Then there is a form that calls register to add a
cookie. The onClick event handler also calls history.go(0) to redraw the
page.

Register Your Name with the Cookie-Meistervar
yourname = getCookie("TheCoolJavaScriptPage") if (yourname != null)
document.write("Welcome Back, ", yourname)else document.write("You
haven't been here in the last year...")
Enter your name. When you return to this page within a year, you will be
greeted with a personalized greeting. Enter your name:



Messages by Day
May 31st 2001
May 30th 2001
May 29th 2001
May 28th 2001
May 27th 2001
May 26th 2001
May 25th 2001
May 24th 2001
May 23rd 2001
May 22nd 2001
May 21st 2001
May 20th 2001
May 19th 2001
May 18th 2001
May 17th 2001
May 16th 2001
May 15th 2001
May 14th 2001
May 13th 2001
May 12th 2001
May 11th 2001
May 10th 2001
May 9th 2001
May 8th 2001
May 7th 2001
May 6th 2001
May 5th 2001
May 4th 2001
May 3rd 2001
May 2nd 2001
May 1st 2001


Messages by Month
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
January 2001


Messages by Year
2008
2007
2006
2005
2004
2003
2002
2001
2000