Hello,

I want a confirm box to appear whenever a user wants to delete a record set. Unfortunately itīs not working like intended. This is my HTML:

Code HTML4Strict:
...
<td>Edward</td>
<td>Example</td>
<td><a href="http://example/users" id="delete_33" class="delete">delete</a></td>
...

This is my JavaScript:

Code JavaScript:
var confirmDeletion = function() {
  var url = window.location.href;
  document.getElementsByClassName('delete').each(function(del) {
    var confirmDel = function() {
      var check = confirm('Are you shure?');
      if (check == true) {
        alert(url + 'delete/' + this.id);
        window.location.href = url + 'delete/' + this.id;
      }
    }
    Event.observe(del, 'click', confirmDel);
  });
};
Event.observe(window, 'load', confirmDeletion);

http://example/users - Thereīs the list with all record sets. http://example/users/delete/ - the URL of the deletion controller.

It may look strange - my JavaScript knowledge is very poor. There are two problems. When I push the cancel button in FF the page reloads ... but the confirm box should just close. And in IE the id is undefined.


Thanks,

oerdec