Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 79 - 2609_Logicode
P. 79

    Code
                          6      Create a web page to demonstrate the use of Alert Box in JavaScript.

                     <!DOCTYPE HTML>
                     <HTML>
                     <HEAD>
                     <TITLE>Form Submission Alert</TITLE>

                     <SCRIPT>
                     {
                     alert("Please fill out all fields.");

                     }
                     </SCRIPT>
                     </HEAD>
                     <BODY>

                     <H1>Contact Form</H1>
                     <FORM>
                     <LABEL>Name:</LABEL>

                     <INPUT TYPE="TEXT" ID="NAME" NAME="NAME" REQUIRED><BR><BR>
                     <LABEL>Email:</LABEL>
                     <INPUT TYPE="EMAIL" ID="EMAIL" NAME="EMAIL" REQUIRED><BR><BR>
                     <BUTTON TYPE="SUBMIT">Submit</BUTTON>

                     </FORM>
                     </BODY>
                     </HTML>
                     The output of the preceding HTML code is as follows:

                     CONFIRM BOX

                     A Confirm Box asks the user to confirm or cancel an action. If the user clicks OK, it returns true;
                     if Cancel is clicked, it returns false. The confirm() function is used to trigger the confirm box.
                     It’s commonly used for actions like deleting or submitting forms.

                                                                                               JavaScript for Beginners  77

| 74 75 76 77 78 79 80 81 82 83 84 |