Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 121 - 2625 PortGPt V2.1
P. 121

    i = i - 1;

                                        document.write("The factorial of " + a + " is "+ f);
                              }

                              //-->

                         </script>
                         <input type="button" onclick="clickevent()" value="Click Here"/>

                         </body>

                         </html>

                         tech Practice                                                                 Computational Thinking

                         What happens when we run this code:

                         1.  <html>
                             <script>
                                 function changecolour()
                                 {
                                     document.getElementById("input1").style.background="aqua";
                                 }
                             </script>
                             <body>
                             <h2> Enter text in the textbox and see the colour change!</h2>
                             <input type="text" id="input1" onfocus="changecolour()">
                             </body>
                             </html>

                             Output:

                                                                                          Introduction to Event Handling  119

| 116 117 118 119 120 121 122 123 124 125 126 |