Powered by Blogger.

Thursday, February 27, 2014

alert() method examples in JavaScript



In this post we will discuss some examples of alert() method in javascript. Also you can also check out my previous posts on:

- Triggers in sql server 2008

- What is difference between machine.config and web.config file in Asp.Net?

- Encrypt and Decrypt a file in C#.Net

Below are some examples:

Example-1:
 <script language="JavaScript" type="text/javascript">
        alert("Javascript dialog example");
    </script>
Example-2:
In this example we can see how we can show message in dialog box in multiple lines.

<script language="JavaScript" type="text/javascript">
        alert("JavaScript Alert\n Multiple Line Example");
    </script>


Example-3:
In this example we will see how we can show message from variables in a dialog box.

 <script language="JavaScript" type="text/javascript">
        var firstmsg = "This is the first message! ";
        var secondmsg = "This is the second message! ";
        alert(firstmsg + secondmsg);
    </script>






0 comments

Post a Comment