On 10/29/06, Dean <[EMAIL PROTECTED]> wrote:
>
> Hi everyone,
>
> What is the unobtrusive way to add a confirm dialog to an anchor? This
> code doesn't quite work:
>
> /* Adds a confirm dialogue to elements */
> function addConfirms()
> { var e = getConfirmElements();
> for( var c = 0; c < e.length; c++ )
> { e[c].message = 'Confirm this?';
> MochiKit.Signal.connect( e[c], 'onclick', confirmDialog );
> }
> }
> function confirmDialog(evt)
> { evt.stop();
> if( ! this.message )
> { this.message = 'Really?'; }
> return confirm(this.message);
> }
>
> Leaving out the evt.stop() clicks the link no mater what the confirm
> return code is.
if (!confirm(this.message)) {
evt.stop();
}
-bob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/mochikit
-~----------~----~----~----~------~----~------~--~---