In this article I will explain with an example, how to display 
MessageBox using 
JavaScript in HTML.
 
     
    HTML Markup
    The HTML Markup consists of following element:
    Button – For displaying MessageBox.
    The 
Button has been assigned with a 
JavaScript onclick event handler.
        <input id="btnSubmit" type="button" value="Submit" onclick="OnSubmit()" />
     
     
     
    Displaying MessageBox using JavaScript
    When the 
Submit Button is clicked, the message is displayed using 
JavaScript Alert 
MessageBox.
        <script type="text/javascript">
            function OnSubmit() {
                alert("Form has been submitted.");
            }
        </script>
     
     
     
    Screenshot
    ![Display MessageBox using JavaScript in HTML]() 
     
     
    
        Browser Compatibility
        
        * All browser logos displayed above are property of their respective owners.
         
         
     
    Demo
    
     
     
    Downloads