Im decent at html& javascript, but, i still need some help implementing some code cause i have no idea were to put the exact code, I have it set up so when you go to my website, you are prompted to type in a codename, and it saves it in your cookies, so next time you visit, it checks your cookies and greets you with your codename. I want to make it so when you visit, it changes the greeting based on what day it is. here is a snippit of my web code.
<html>
<head>
<script type="text/javascript">
// This is the Script for the popup Window
function getCookie(c_name)
{
var i,x,y,ARRcookies=document.cookie.split(";");
for (i=0;i<ARRcookies.length;i++)
{
x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
x=x.replace(/^\s+|\s+$/g,"");
if (x==c_name)
{
return unescape(y);
}
}
}
function setCookie(c_name,value,exdays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value;
}
function checkCookie()
{
var username=getCookie("username");
if (username!=null && username!="")
{
alert("Welcome back " + username);
}
else
{
username=prompt("Please enter your code name:","");
if (username!=null && username!="")
{
setCookie("username",username,365);
}
}
}
// This is the end
</script>
</head>
<body onload="checkCookie()">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>ScratchMillitaryGames</title>
</head>
0
My Url is HERE
0
0
0
oh no a creeper found a piggy! + =
0
Ill one up jsut one notch ill give it out of 5
0
0
0
Also, Vist my minecraft skin website https://sites.google.com/site/anasionmcs/ please? there are some cool skins that i made and they are free!
0
0