Popup Box in JavaScript

In this section you will study how to retrieve the year from the date. You can see in the given example that we have called SimpleDateFormat class showing the format of year.

Popup Box in JavaScript

Popup Box in JavaScript

     

Popup is used to create and show a component to the user, usually available on top of the window component in a particular hierarchy. The Popups have a small life cycle. Incase you have a Popup and u call a hidden method ,then you are no longer to call any method further.This provides you the Popup Factory to reserve in a cache that can be use latter according to the requirement. 

Popups are of three type-

  1. Alert Popup Box
  2. Confirm Popup Box
  3. Prompt Popup Box

In this Tutorial we want to describe you "Alert Popup Box", This box is used when a programmer wants the user to know the information on clicking a specified component. When an alert pop up, the user need to click on "ok" to work further.

Let  us Understand with Example 

In this Example we want to provides you an information on how to implement Alert Popup Box. To make your Browser to execute a script on the loading of  page, we  need to call a script into a function. This function contain the list of expression or statement that will be executed by an event. We can call a function from any of the page. The calling function is to be embedded or defined both in the head and body section of a code. If you want your code to be reloaded  in the browser, then the corresponding  function should be placed in head section of the code.

1)type-This signifies the type of component that is created by the programmer, here we create a button component.

2)value-This signifies you to display the text on the specified component, here we specified a button with a label name" click me"

 On clicking the specified button the function  " message" is invoked that contain a user defined alertmessage ("Hi to Everyone!"),When an alert pop up the user need to click on "ok" to work further.

  <html>
  <head>
  <script type="text/javascript">
  function message()
  {
  alert("Hi to everyone!");
  }
  </script>
  </head>
   <body>
   <form>
   <input type="button" value="Click me!"
   onclick="message()" >
</form>
</body>
</html>

 

Now the save file with extension radio.Html and run on your browser.