Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-05-2012, 07:36 AM   PM User | #61
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,448
Thanks: 0
Thanked 496 Times in 488 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
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.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/

Last edited by felgall; 03-05-2012 at 07:42 AM..
felgall is offline   Reply With Quote
Reply

Bookmarks

Tags
document, element, jahava, script

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:50 PM.


Advertisement
Log in to turn off these ads.