Friday, November 12, 2004

Javascript - confirm code - e.g. Are you really sure you want to cancel your changes?

The good old javascript confirm e.g. Are you really sure you want to cancel your changes?

Place this in the header part of the html:

<html>
<head>
<script LANGUAGE="JavaScript">
<!--
// Confirm user wants to cancel the changes
function confirmCancel()
{
var cancelChanges=confirm("Are you sure you wish to cancel your changes?");
if (cancelChanges)
return true ;
else
return false ;
}
// -->
</script>
</head>
<body>
<form name="form1" method="post" action="">
<input TYPE="SUBMIT" name="sub_cancel" value="Cancel" onClick="return confirmCancel();">
</form>
</body>
</html>



Add the text in bold to your submit button.