|
| |
|
|
|
|
|
|
|
|
|
|
| |
|
|
|
|
|
|
Topic : Demo of Cookies By: Shaikh Zaid
|
|
Author : Shaikh Zaid
|
Total Visits: 86
|
|
Published Date:
Friday, March 09, 2001
|
|
|
|
|
|
WELCOME TO OUR SITE
Contact Me
<script language="JavaScript">
function GetCookie (cname) {
var arg = "oops=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
function getCookieVal(offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function DeleteCookie (name) {
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
var expDays = 30;
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
function amt(form){
var count = GetCookie('oops')
if((count != document.frm.uname.value) && (document.frm.uname.value!="Please Enter Your Name Here")) {
SetCookie(document.frm.uname.value)
return 1
}
else {
alert("Hi, "+count.toUpperCase());
}
}
</script>
<script for=window event=onload>
window.status="Welcome to Bits N Bytes Computer Solutions: Designed by Shaikh Zaid";
var ct=GetCookie('oops');
if(ct!=null){
alert("Hi, " + ct.toUpperCase() );}
else{
alert("Welcome please enter ur name in the text box");}
</script>
<script>
function SetCookie(valu)
{
document.cookie='oops='+valu+"; expires"+10/10/2002
alert("The cookie has Been SET Visit this page next time and see the difference");
}
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|