Page 309 - Web Applications (803) Class 11
P. 309

document.write(result);
                   </SCRIPT>
                   </BODY>

                   </HTML>
                 Output:




















                                                 Lab Assignment ‘n Activity                          Subject Enrichment




                   Give the output of the following code:
                   1.  str1 = “She dropped the glass”;
                       document.write(str1.substring(3,14))
                   2.  document.write (parseFloat(“I am 18 years old”))
                   3.  document.write(eval(“7” + “5”))
                   4.  ans=eval(“78” – “65”);
                       document.write(ans)
                   5.  document.write(Number(“12 67”))
                   6.  document.write(Boolean(34>68))


                            Notes


                           Python has piqued the interest of 30% of developers who haven’t worked with it before. Second on the list is
                           JavaScript. 18.5 percent of developers expressed an interest in learning and developing in the field.
                                                                                        [Stack Overflow Annual Survey 2020]



                   4.15 INTERACTING WITH USER—DIALOG BOXES

                 You already know that a dynamic website requires user involvement to function. A user inputs data into a website
                 using a variety of methods, such as a keyboard or a mouse, and receives a response. The simplest way for a user to
                 interact with a website is through dialog boxes. The user can be given information or asked to input a value that the
                 application demands.
                 We’ve already seen document object methods for displaying data on a web page. Similarly, window is an object with its
                 own set of methods. Dialog boxes are used by the window object to interface with the user. Three methods are used to
                 build dialogue boxes: alert( ), prompt( ), and confirm( ). These methods do not need the presence of a window object
                 by default. Since the window object is a top-level object, it is not necessary to mention it when the method is invoked.




                                                                      Introduction to Dynamic Websites Using JavaScript  307
   304   305   306   307   308   309   310   311   312   313   314