I've actually found the cause of my problem. 
Quite foolish of me. I had earlier experimented with having all my 
javascript after the footer of the page rather than in the <head>. So I had 
2 instances of the script tag that contained this code on 1 page.

I am grateful to everyone for their help. I learned much and was able to 
decrease the number of lines of code needed.

On Monday, 16 July 2012 06:53:25 UTC-4, Victor wrote:
>
> My problem is that after the confirm() UI appears and is clicked, it 
>> appears AGAIN, then when I click again does the expected behaviour occur.
>>
>> document.observe("dom:loaded", function() {
>>   // attach to all delete links in the table
>>   var dels = $$('td a.delete');
>>   dels.each(function(s){
>>     s.observe('click', function(event){ confirmDelete(event); }  );
>>   } )
>> });
>>
>>
>> function confirmDelete(event)
>> {
>>     var ask = confirm('Are you sure you want to delete this entry?');
>>     
>>     if(ask){ xfoo = 'follow link - delete it'; }
>>     else{ event.stop();  xfoo =' do nothing - stop event ';      }
>> }
>>
>>
> Try to show target of click events in your confirmDelete(), e.g. like this:
>
> function confirmDelete(event) {
>     var ask = confirm('Are you sure you want to delete this entry?' +
>       '\n(clicked on ' + Object.inspect(event.findElement()) + ')');
>     if(ask){ xfoo = 'follow link - delete it'; }
>     else{ event.stop();  xfoo =' do nothing - stop event ';      }
> }
>
> It will give additional information, e.g. that your code receives click 
> events from both A and IMG elements.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/prototype-scriptaculous/-/9U-Vxp9cZScJ.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to