How to add a cancel button to an alert feature in JS?

Question by Al: How to add a cancel button to an alert feature in JS?
Hello,
What I would like would be to be ale to have an alert feature but instead of there just being the OK button, i would also like a cancel button. (this is for a contact form)

My current code

function theAlert () {
alert (“Your Email address will not be sold on”);
}

The reason is so that it will not continue to the next page straight away

Regards

Best answer:

Answer by Adam
Use the Javascript confirm function.
http://www.globalguideline.com/JavaScript_Guide/Java_Script_Confirmation_Boxes.php

Add your own answer in the comments!

Get the book now