Javascript OK/Cancel Message Box Example

Here's a quick little example of how to capture the standard windows Ok/Cancel message box return value.

Here's a quick little example of how to capture the standard windows Ok/Cancel message box return value.

<HTML>
<SCRIPT language=JavaScript>

function MsgOkCancel()
{
var fRet;
fRet = confirm('Are you sure?');
alert(fRet);
}

</SCRIPT>
<BODY>
<a href=javascript:MsgOkCancel(); >test me</a>
</BODY>
</HTML>


Submission Date:  9/23/2005 3:01:51 PM
Submitted By:  Robbe Morris
My Home Page:  http://www.robbemorris.com

By Robbe Morris   Popularity  (1045 Views)
Picture
Biography - Robbe Morris
Robbe has been a Microsoft MVP in C# since 2004. He is also the co-founder of NullSkull.com which provides .NET articles, book reviews, software reviews, and software download and purchase advice.  Robbe also loves to scuba dive and go deep sea fishing in the Florida Keys or off the coast of Daytona Beach. Microsoft MVP