Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2004
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Defaulting to the cancel button

    In javascript is it possible to default to the cancel button in a confirm prompt box e.g:

    var ans = confirm("Are you sure you would like to delete this file?");
    if (ans)
    return true;
    else
    return false;


    It seems to always default to the 'OK' button.

    Any help with this would be most appreciated.

    Many Regards,
    Ben Chivers

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    No, as far as I know, you can not change the default OK in confirm because always the implicit boolean affirmative entrance (to use it in an if statement) must be unique and was implemented to be OK.

    Yet, you may build a graphic a-like layer which can have a Cancel button focused if you badly need something similar...
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

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