Click here to Skip to main content
15,848,415 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Friends,


Can any one tell me, how to display a message box in web using JavaScript?

I already found code from Google for displaying msgBox in web. But, it is confirm box only which displays OK and CANCEL buttons on it..


I need to display a message box in web in JavaScript with YES and NO buttons..

Is there any code to display like that?








Thanks & Warm regards,

Ragamaie
Posted

You cannot modify confirm box of javascript. Take a look at jQuery options.
http://projectshadowlight.org/jquery-easy-confirm-dialog/[^]
 
Share this answer
 
 
Share this answer
 
v2
use this :-
VB
public static void MessageBox(System.Web.UI.Page senderPage, string alertMsg, string alertKey)
      {
          string strScript = "<script language=JavaScript>alert('" +alertMsg + "')</script>";
          if (!(senderPage.IsStartupScriptRegistered(alertKey)))
              senderPage.RegisterStartupScript(alertKey, strScript);
      }



and call from aspx.cs with Three parameter
try this.
 
Share this answer
 
v2
You can use this :
JavaScript
<script language="javascript">
    function window.confirm(str) {
        execScript('n = msgbox("' + str + '","4132")', "vbscript");
        return (n == 6);
    }
</script>

But this only works in IE
So better to use jquery ui : Jquery UI
 
Share this answer
 
Comments
Dalek Dave 4-Oct-11 3:40am    
Edited for Code Block
XML
<html>
<head>
<script type="text/javascript">
function show_alert()
{
alert("Project has been add");
}
</script>
</head>
<body>

<input type="button" onclick="show_alert()" value="Save" />

</body>
</html>


or for sample...

http://www.ajaxcontroltoolkit.com/ConfirmButton/ConfirmButton.aspx[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900