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.
Page 5 of 5 FirstFirst ... 345
Results 61 to 61 of 61
  1. #61
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,627
    Thanks
    0
    Thanked 648 Times in 638 Posts
    Quote Originally Posted by webdev1958 View Post
    Are you asking me in particular or everyone?
    Everyone.

    Using an alert, confirm or prompt asks some of your visitors if they want to turn off JavaScript for your web page. It asks some other visitors if they want to cease displaying alerts/confirms/prompts on your page.

    Since it only asks some people one question, other people a different question, and still others no question at all, it would only make sense to use any of them where you control the browser being used - either on an intranet or for debugging.

    To return to what the OP was asking about with pages that only work with JavaScript enabled you would definitely need to avoid using alert, confirm, or prompt on a page that only works with JavaScript enabled. If you did use one of them then you are asking for your visitors to break your page by telling them to turn off the script.

    It wasn't me that decided that alert confirm and prompt should only be used for debugging. It was the people who wrote Opera and Internet Explorer who changed the options that those dialogs display.

    An alert now effectively asks the question of whether to continue running the script or not - click OK to continue or the other option to disable JavaScript for this page only. A confirm has three possible answers - OK to return true to the script, cancel to return false to the script or the third option that doesn't return to the script at all.

    If you don't want to ask your visitors if they want to turn off JavaScript then you can't use alert, confirm or prompt because they will ask some of your visitors that question. If you dot want to ask that question you can't use them either because it will only ask some of your visitors that question, not all of them.
    Last edited by felgall; 03-05-2012 at 07:42 AM.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


 
Page 5 of 5 FirstFirst ... 345

Tags for this Thread

Posting Permissions

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