Hey guys... basically I want it so a user enter there name, strikes enter and a welcome message is displayed... not happening for me though...
------------------
<html>
<head>
<title></title>
<script language="JavaScript">
expireDate = new Date;
expireDate.setMonth(expireDate.getMonth()+6);
firstName = "";
if (document.cookie != "") {
firstName = document.cookie.split("=")[1];
}
function setCookie() {
firstName = document.myForm.nameField.value;
document.cookie = "firstName="+firstName+";expires=" +
expireDate.toGMTString();
}
</script>
</head>
<body>
<form name="myForm">
Name:
<input type="text" name="nameField" onBlur="setCookie()">
</form>
<script language="JavaScript">
if (document.cookie != "") {
document.write("<br>Welcome to my site, " + firstName);
}
</script>
</body>
</html>
------------------
<html>
<head>
<title></title>
<script language="JavaScript">
expireDate = new Date;
expireDate.setMonth(expireDate.getMonth()+6);
firstName = "";
if (document.cookie != "") {
firstName = document.cookie.split("=")[1];
}
function setCookie() {
firstName = document.myForm.nameField.value;
document.cookie = "firstName="+firstName+";expires=" +
expireDate.toGMTString();
}
</script>
</head>
<body>
<form name="myForm">
Name:
<input type="text" name="nameField" onBlur="setCookie()">
</form>
<script language="JavaScript">
if (document.cookie != "") {
document.write("<br>Welcome to my site, " + firstName);
}
</script>
</body>
</html>