Link to home
Start Free TrialLog in
Avatar of erot
erot

asked on

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

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?
Avatar of martinag
martinag

confirm("String"). Here's an example:

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

Martin
Avatar of erot

ASKER

Great stuff....thanks!

Erot / Norway
ASKER CERTIFIED SOLUTION
Avatar of martinag
martinag

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I see the autograding is working again. Nice. Too bad it has to be used though.

Martin