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 06-09-2012, 02:09 AM   PM User | #1
cg_chinmay
New to the CF scene

 
Join Date: May 2012
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
cg_chinmay is an unknown quantity at this point
Question PROMPT button

How to use cancel and ok buttons of prompt inorder to trigger some event in response to them?
cg_chinmay is offline   Reply With Quote
Old 06-09-2012, 02:21 AM   PM User | #2
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,462
Thanks: 0
Thanked 499 Times in 491 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
You shouldn't really be using prompt at all as it can have more than two options show up as it is intended for use as a debugging tool.

__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Old 06-09-2012, 04:36 AM   PM User | #3
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,462
Thanks: 0
Thanked 499 Times in 491 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Quote:
Originally Posted by iBall View Post
If you are including me then I disagree because ...
I was directing that at everyone but since you mention it I specifically disagree with letting any intermediate and beginner JavaScript programmers know that prompt() even exists because it creates bad habits and they really ought to be using a simple form in their page to collect the information (which is no harder to code and a lot more useful for them to know).

Anywhere that beginners are using prompt() they should be using <form>

prompt was only easier back when document.write was used instead of innerHTML and so you couldn't actually display anything in the actual web page.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Old 06-09-2012, 07:54 AM   PM User | #4
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,462
Thanks: 0
Thanked 499 Times in 491 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Quote:
Originally Posted by iBall View Post
that's ok. I'm the opposite and so we'll just have to disagree on this one because I will continue to tell beginners on the websites I post on that using document.write is ok under the conditions I posted earlier
One day you will wake up and discover that the 20th Century is over. Until that day comes - perhaps in a few hundred year's time - I am sure that we can quite happily continue to disagree.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Old 06-09-2012, 08:21 AM   PM User | #5
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,044
Thanks: 197
Thanked 2,412 Times in 2,390 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Quote:
Originally Posted by iBall View Post
I knew it was over when I woke up on the morning of Jan 1, 2001 with a very sore head .
And still got it, it seems. Is that why you behave like a bear with a sore head? Always in a bad mood which causes you to treat other people badly and complain a lot?
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Philip M is online now   Reply With Quote
Reply

Bookmarks

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 08:22 AM.


Advertisement
Log in to turn off these ads.