Cookie question
- From: "DoomedLung" <doomedlung@xxxxxxxxxxxxxx>
- Date: 15 Sep 2006 10:10:07 -0700
Hey, I recently bought "The Javascript and DHTML Cookbook" by Danny
Goodman.
I'm at Chapter 1, part 1.9 "Reading and Writing Strings for Cookies"
and was just interested in a utility function that grabs a cookie
value:
function getCookieVal(offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1) {
endstr = document.cookie.length;
}
return unescape(document.cookie.substring(offset, endstr));
}
The part I don't understand is the if statement within the function,
why is it checking if endStr equals to false?
The book is kinda vague in explaining what this means! Any help would
be great.
Cheers
.
- Follow-Ups:
- Re: Cookie question
- From: Tom Cole
- Re: Cookie question
- Prev by Date: Re: Javascript on steroids!
- Next by Date: Re: Prevent user copy + pasting from one field to next
- Previous by thread: Re: usefull javascript page
- Next by thread: Re: Cookie question
- Index(es):
Relevant Pages
|