|
-
Dec 30th, 2002, 03:09 PM
#1
Thread Starter
Lively Member
Cookie help
Hey
I have a text box, in which a user enters his/her name. How can I set it so that it 'saves' the users name via a cookie, and then recalls it into the same text box, next time the user visits the page?
Thanks for your help
James
Ich widerstehe allem - nur nicht der Versuchung
(I can resist anything but temptation)
-
Dec 30th, 2002, 08:59 PM
#2
Lively Member
<head>
<script language="javascript">
<!--
function checkC()
{
var the_cookie=unescape(document.cookie).split(":");
if(the_cookie[1])
{
document.getElementById("username").value=the_cookie[1];
document.getElementById("cName").style.visibility="hidden";
}
}
function savecookie()
{
var username=document.getElementById("username").value;
var the_date=new Date("December 31, 2023");
the_date.toGMTString();
document.cookie="myCookie="+escape(username);+";expires="+the_date;
}
-->
</script>
</head>
<body onLoad="checkC()">
<input type=text id=username>
<input type=button onClick="savecookie" id=cName value="save cookie">
</body>
i didnt test this or anything. hope it works
if you choose not to decide you still have made a choice!
RUSH rocks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|