The problem is the function createCookie wont expire (delete) a cookie if passed the variable str, which gets its value from a GridView in ASP.NET. I confirm the str is what I expect with an alert. But if I pass a simple string it works. So my guess is the value of str somehow isnt a true string or something like that?
function delete()
{
var str = document.getElementById(‘GridView1’).rows[1].cells[0].innerText;
alert(‘String is ‘ + str);
createCookie(str,””,-1);
var n1;
n1 = ‘Nutmeg’;
createCookie(n1,””,-1);
return false;
}
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60
var expires = “; expires=”+date.toGMTString();
}
else var expires = “”;
document.cookie = name+”=”+value+expires+”; path=/”;
//alert(‘cookie = ‘ + document.cookie);
}