views:

28

answers:

1

not sure what i am doing wrong below. any pointer is greatly apprecited. i am being returned "-1". Not sure if i am creating incorrectly (cookies exist and are listed at 161 or so), but not sure if mine is in this group.

<html>
<body>
 <div id="cookieLaunch" onClick="cM()">abcdef</div>
<script>
 function cM(){
 var cookie_date = new Date ( 2011, 01, 15 );
document.cookie =  'ppkcookie1=testcookie; expires='+ cookie_date.toGMTString()+'; domain=myDomain.com';
alert(document.cookie.indexOf('ppcookie1='));
}
</script>
</body>
 </html>

i was trying to find the cookie in a way that was not finding it. personal erorr.

+1  A: 

It looks like you have an extra or missing k in ppkcookie or ppcookie. :) Here you have ppkcookie:

document.cookie =  'ppkcookie1=testcookie; expires='+ cookie_date.toGMTString()+'; domain=myDomain.com';

And here you have ppcookie:

alert(document.cookie.indexOf('ppcookie1='));
Munzilla
yep. dumb typo and also realized a better method to find. thanks very much though.
jason m