Page 114 - CodePilot V5.0 C8
P. 114

<TITLE>Using Function</TITLE>

                  <SCRIPT>
                  function changeColour()
                  {

                  document.body.style.backgroundColor = "lightblue";
                  }
                  </SCRIPT>

                  </HEAD>
                  <BODY>
                  <H1>Click the Button to Change the Background Colour</H1>

                  <BUTTON onclick="changeColour()"> Change Colour </BUTTON>
                  </SCRIPT>

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

















                  The function changes the background colour of the web page to light blue using JavaScript.

                      PRIVACY PRACTICES

                      Developers should always sanitize data. This means they need to ensure that the data a user
                      enters into a website is safe before using it.






                         JAVASCRIPT POPUP BOXES

                  The JavaScript popup boxes are used to interact with users by displaying messages or requesting
                  input. There are three main types of popup boxes: Alert Box, Confirm Box and Prompt Box.


                  ALERT BOX

                  The Alert box displays a message and can only be closed by the user clicking the OK button.
                  This box is often used to show important information or warnings. The alert() function is used to
                  trigger the alert box.



                   112
                        CodePilot (V5.0)-VIII
   109   110   111   112   113   114   115   116   117   118   119