I'm beginning to think that I don't have the eyes for this. Chrome's JS console is telling me that on line 28 "setCookie is not defined". What does this mean? I've looked at the function portion and it looked the same as my book but I have missed punctuation/spelling before. Thanks again whoever answers.
Jake
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Personal Preferences</title>
<script type="JavaScript">
<!-- HIDE FROM INCOMPATIBLE BROWSERS
function setCookie() {
var expiresDate = new Date();
expiresDate.setFullYear(expiresDate.getFullYear() + 1);
document.cookie = encodeURI("user_name=" + document.forms[0].user_name.value) + "; expires=" + expiresDate.toUTCString();
document.cookie = encodeURI("user_color=" + document.forms[0].user_color.value) + "; expires=" + expiresDate.toUTCString();
window.alert("Your name and favorite color have been saved in a cookie.");
}
// STOP HIDING FROM INCOMPATIBLE BROWSERS -->
</script>
</head>
<body>
<form action="">
<p>Name: <input type="text" name="user_name" /><br />
Favorite color: <input type="text" name="user_color" /></p>
<p><input type="button" value="Set Cookie"
onclick="setCookie();" /></p>
</form>
</body>
</html>