Results 1 to 1 of 1

Thread: DHTML Modal onclose dirty check

  1. #1
    Join Date
    Oct 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default DHTML Modal onclose dirty check

    1) Script Title:
    DHTML Modal window v1.1

    2) Script URL (on DD):
    http://www.dynamicdrive.com/dynamici...dhtmlmodal.htm

    3) Describe problem:
    I'm having trouble understanding exactly how the X works. When I right click and inspect the element, all I see is an image with no click event and just a Title of "Close". I tried commenting this line in dhtmlmodalwindow.js as I thought this was attaching the click event to this img:
    t.controls.onclick = dhtmlwindow.enablecontrols

    but the X still works. Basically, I want to be able to intercept the close event (X), check a javascript variable (is the form dirty) and prompt to user with a jquery confirm dialog (Are you sure you want to Proceed?). This is easily being done in non-modal forms by using jQuery to bind to the click event of all <a>'s on the page that could take the user away from a dirty form, checking the flag and letting the event go through if they confirm otherwise cancel. I'm a bit stuck on how I can do something similar with this X. I thought I'd try to make it an <a> so it'd be picked up but need to understand how this event gets wired up. Any pointers would be greatly appreciated.
    Last edited by voracious27; 10-18-2010 at 05:58 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •