Thanks. I read the tutorial from the first url and also had a look at the second ressource.
However, for my simple case, I decided to do without the ressource from texotela.
I improved my code, but for the function that handles the click() event, there is some strange thing : the condition (this.checked) is never met, even if I replace this.checked=LireCookie(...) by this.checked=true in the initialization block.
this.checked appears undefined also for the checkboxes that are checked.
Any idea why ? Should I use some other function to test the checked status ?
Thanks.
$(document).ready(function(){
// Initialize checkboxes according to the value stored in cookies :
$("div.chkInfo input[@type='checkbox']").each(function(){
this.checked=LireCookie(this.value); // LireCookie returns true or null;
});
$(this).click(function(){
if (this.checked){
alert("THIS CASE NEVER OCCURS. WHY ?");
date=new Date;
date.setMonth(date.getMonth()+1);
EcrireCookie(this.value, this.checked, date);
} else {
alert("Erase the cookie");
EffacerCookie(this.value)
}
});
});