Page 121 - PortGPT_V2.1_C8_Flipbook
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