Thursday, March 5, 2009

JavaScript: Add a prompt dialogue box to confirm the changes when user selects to “close” the InProgress work window.

Here is the sample on how you can have a prompting dialogue box when user tries to exit the window with work in progress.

*************************************************
Sample Code: Just copy paste this code in your html file and it should work.
*************************************************
<script language="JavaScript">

var isChoice = 0;

function callAlert(Msg,Title){

txt = Msg;
caption = Title;
vbMsg(txt,caption)
alert(isChoice);

}
</script>

<script language="VBScript">

Function vbMsg(isTxt,isCaption)

testVal = MsgBox(isTxt,3,isCaption)
isChoice = testVal

End Function

</script>


<input onclick="callAlert('Do you want to save the changes to Document1?','Document1')" type="button" value="Exit">

*************************************************

Please contact me @ shasiza@gmail.com if you have any question or issues implementing this script.

No comments: