|
You can do this in VBScript. <script language="VBScript"> myPrompt = MsgBox("Are you sure you want to delete?",3,"Important Question") </script> Variable myPrompt will contain 6 for yes, 7 for no an 2 for cancel. Unfortunately, javascript does not provide a configurable alert box. You could alternatively use a html popup like the following which I found somewhere. Just need to edit it to your taste: <html> <head> <title>Confirm-box</title> </head> <body>
<SCRIPT LANGUAGE="JavaScript"> <!-- var winConfirm = null; function showConfirm() { var windowWidth = 250; var windowHeight = 100; var locX = ( screen.width - windowWidth ) / 2; var locY = ( screen.height - windowHeight ) / 2; var windowFeatures = "width=" + windowWidth + ",height=" + windowHeight + ",screenX=" + locX + ",screenY=" + locY + ",left=" + locX + ",top=" + locY; if ( ( winConfirm != null ) && !winConfirm.closed ) { winConfirm.close(); } winConfirm = open( "", "winConfirm", windowFeatures ); var theHTML = '<HEAD><TITLE>Please choose...</TITLE></HEAD>' + '<BODY BGCOLOR="#FFFFFF">' + '<CENTER><B>' + 'Click on YES, NO or CANCEL' + '</B><FORM NAME="buttonForm">' + '<INPUT TYPE="button" VALUE=" YES "' + ' ONCLICK="opener.buttonClicked(0);self.close();">' + ' ' + '<INPUT TYPE="button" VALUE=" NO "' + ' ONCLICK="opener.buttonClicked(1);self.close();">' + ' ' + '<INPUT TYPE="button" VALUE="CANCEL"' + ' ONCLICK="opener.buttonClicked(2);self.close();">' + '</FORM></BODY>'; winConfirm.document.writeln( theHTML ); } function buttonClicked( buttonChoice ) { switch( buttonChoice ) { case 0: document.myForm.showResult.value = "YES"; break; case 1: document.myForm.showResult.value = "NO"; break; case 2: document.myForm.showResult.value = "CANCEL"; break; default: document.myForm.showResult.value = "(void)"; } } //--> </SCRIPT> <FORM NAME="myForm"> <INPUT TYPE="button" VALUE="Click here to see the confirm window" ONCLICK="showConfirm();"> <BR><BR><B>The last button clicked was:</B> <BR><INPUT NAME="showResult" TYPE="text" SIZE="10" VALUE="(void)" ONFOCUS="blur();"> </FORM> </body> </html>
------------- http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker
|