Yep,
this is JavaScript and your syntax apparantly looks fine, try reading a cookie and alert its value, are you having this problem with all browsers? See if your browser is set to accept cookies, also only the domain which created the cookie can read it. I couldn't find anything wrong here (though, it's been quite some time since I have done it using JavaScript), have a look at
this, and see if it is of any help, may be just a mistake in sequence, or incorrect value somewhere...
HTH,
- Manish