Solved

JavaScript, Alert...Yes No not only OK ???

Posted on 1998-12-21
4
7,948 Views
Last Modified: 2008-06-24
When the client hit a button on a page I want to ask him
a question. I want to display a messagebox with two buttons,
Yes and No. And I want the client script to be able to
check if the user hit Yes or No. Is this possible? Example
code please?
0
Comment
Question by:erot
  • 3
4 Comments
 
LVL 4

Expert Comment

by:martinag
ID: 1840927
confirm("String"). Here's an example:

answer = confirm("Yes or no?");
if (answer == true)
  pressed = "yes";
else
  pressed = "no";
alert('You pressed "' + pressed + '".');

Martin
0
 

Author Comment

by:erot
ID: 1840928
Great stuff....thanks!

Erot / Norway
0
 
LVL 4

Accepted Solution

by:
martinag earned 50 total points
ID: 1840929
Here's an answer for you to grade.

Martin
0
 
LVL 4

Expert Comment

by:martinag
ID: 1840930
I see the autograding is working again. Nice. Too bad it has to be used though.

Martin
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now