Solved

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

Posted on 1998-12-21
4
7,946 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Someone recently asked me about how to display a progress indicator on a page while an iframe is loading. And I remember when I first came across this myself. It was a bit tricky to get my head around, but really, it's very simple. The most impor…
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…

746 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

12 Experts available now in Live!

Get 1:1 Help Now