Showing posts with label delete. Show all posts
Showing posts with label delete. Show all posts

Wednesday, 10 December 2008

Dynamic HTML select objects

Want to use JavaScript to remove all elements of a select object? Don't do this:

for (i=0; i < form.yourSelector.length; i++) {
  form.yourSelector.remove(i);
}


...and don't do this either:

l = form.yourSelector.length;
for (i=0; i < l; i++) {
  form.yourSelector.remove(i);
}


Instead, do this:

l = form.yourSelector.length;
for (i=0; i < l; i++) {
  form.yourSelector.remove(form.yourSelector.length - 1);
}

Tuesday, 17 June 2008

Cookies

Currently having problems deleting cookies set using PHP.

I have a need to set them on one server and to be read by scripts in another server. To do so, I need to apply the top level domain when I set the cookies, otherwise I can't read them when the visitor moves subdomains. But for some reason, I cannot delete the cookie from the other server, even if the domain is specified in exactly the same way.

Perhaps its a security feature and therefore just not possible to do?