JavaScript
Confirm Box
Back


Displays a confirm dialog with a text message, OK and Cancel buttons.

There are two parts to this script. Part 1 is placed between the HEAD tag of your document. Part 2 is placed between the BODY tags where ever you want the button or link to display. Change the text between the second set of single quotes to change the URL that is loaded.

Example:

Place part 1 code between the HEAD tags of your document.
Part 1 Code:

 <SCRIPT LANGUAGE="Javascript">
<!---
function decision(message, url){
if(confirm(message)) location.href = url;
}
// --->
</SCRIPT>

Place part 2 code between the BODY tags of your document where ever you want the button displayed.

Change the text between the first set of single quotes to change the text displayed in the confirm window. Change the text between the second set of single quotes to change the URL that is loaded. Change the text between the double qoutes after VALUE= to change text displayed on the button.
Part 2 Code:

<FORM NAME="f"> <INPUT
TYPE="button" VALUE="Crowder Associates Homepage?" NAME="button1"
ONCLICK="decision('Go to Crowder Associates Homepage?',
'http://www.crowderassoc.com')">

A link that displays a confirm dialog box.

Example:

HOT Web site!

Place part 1 code between the HEAD tags of your document.
Part 1 Code:

 <SCRIPT LANGUAGE="Javascript">
<!---
function decision(message, url){
if(confirm(message)) location.href = url;
}
// --->
</SCRIPT>

Place part 2 code between the BODY tags of your document where ever you want the button displayed.

Change the text between the first set of single quotes to change the text displayed in the confirm window. Change the text between the second set of single quotes to change the URL that is loaded. Change the text before the </A> to change the link text.
Part 2 Code:

<A HREF="javascript:decision('Jumping to Crowder Associates Homepage!',
'http://www.crowderassoc.com')">HOT Web site!</A>


Rate this script
Excellent Acceptable Poor
Comment: