Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 116 - CodePilot V5.0 C8
P. 116

    Code
                           7        Create a web page to demonstrate the use of Confirm Box in JavaScript.

                      <!DOCTYPE HTML>
                      <HTML>
                      <HEAD>

                      <TITLE>Confirm Box</TITLE>
                      </HEAD>
                      <BODY>

                      <H1>File Status</H1>
                      <SCRIPT>
                      {

                      let result = confirm("Are you sure you want to delete this file?");
                      if(result)

                      {
                      document.write("File deleted!");
                      }

                      else
                      {

                      document.write("File not deleted.");
                      }
                      }
                      </SCRIPT>

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

                       114
                            CodePilot (V5.0)-VIII

| 111 112 113 114 115 116 117 118 119 120 121 |