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:

 <script language="JavaScript" type="text/javascript">
        alert("Javascript dialog example");
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");

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);