I have this in the head section of my page
<script type="text/javascript">
function makeCookie(name)
{
alert("c is for cookie");
days=30; // number of days to keep the cookie
var myDate = new Date();
myDate.setTime(myDate.getTime()+(days*24*60*60*1000));
expires="myDate.toUTCString();
document.cookie="pull=" + name;
alert("c is for cookie");
}
</script>
And then a bunch of list items that look similar to this:
<a href="#tab2" onclick="makeCookie("LastName FirstName")">LastName FirstName</a>
I’m not getting alerted and no cookie is getting set. So I know I’m doing something wrong. When I check out the JavaScript console in Chrome it gives me token errors as well. So I’m guessing I have a hanging bracket somewhere, but I can’t find it.
Its because you’re using the same type of quotes for
onclickas you are for the parameters tomakeCookie, so it thinks you’re closing the first set of parenthesis when you do “Lastname. Try: