Hi,

I've got a really simple function I want to create, a confirm delete function that is applied to all links with a class of delete. A confirm message appears when the link is clicked, returning false if cancel is clicked.

This is my code and for whatever reason that I just don't get (coz I'm a bit confused by all this stuff), clicking cancel when the confirm message appears seems to return true regardless.

HTML Code:
<a href='/admin/video.php?deletevid=1' class='delete'>Delete</a>
Code JavaScript:
var confirmDelete = 
{
 init: function()
 {
  var links = Core.getElementsByClass("delete");
 
  for (i = 0; i < links.length; i++) 
  {
   Core.addEventListener(links[i], "click", confirmDelete.deleteListener);
  }
 },
 
 
 del: function(link)
 {
  return confirm("Are you sure you want to delete?")
 },
 
 
 deleteListener: function(event)
 {
  confirmDelete.del(this);
 }
 
};
 
Core.start(confirmDelete);

I'm using the core library from the book Simply Javascript.

How do I get this thing to return false, it's got to be somthing simple.

Thanks

Richard.