Page 107 - DCAP202_Fundamentals of Web Programming
P. 107

Fundamentals of Web Programming




                    Notes          Syntactically, you can specify a function name while creating a literal function as follows:
                                   <script  type=”text/javascript”>
                                   <!—
                                   var  variablename  =  function  FunctionName(Argument  List){
                                     Function  Body
                                     };
                                   //—>
                                   </script>
                                   But this name does not have any significance, so worth not to use it.

                                   8.3.2 Built-in Functions

                                   Javascript, first introduced by Netscape, changed the static fate of the HTML web pages. Before
                                   Javascript came into existence, HTML pages were just used to render static content. Inserting
                                   Javascript to a web page, can give it a significant degree of interactivity and functionality. It lets
                                   you control the behavior of the web browser and how the elements of the web page are displayed.
                                   Most web browsers have a built in javascript interpreter. When a browser downloads an html
                                   file that contains javascript, the javascript interpreter reacts to any script.
                                   Javascript is an object oriented programming language. It supports the concept of objects in the
                                   form of attributes. If an object attribute consists of function, then it is a method of that object, or
                                   if an object attribute consists of values, then it is a property of that object.


                                          Example:
                                   var status=document.readyState;
                                   readyState  is  a  property  of  the  document  object  which  can  contain  values  such  as
                                   “unintialized”,”loading”,”interactive”,”complete”  whereas,
                                   document.write(“Hello World”);
                                   write() is a method of the document object that writes the content “Hello World” on the web
                                   page.
                                   There are several Javascript built-in objects such as:
                                      Number
                                      String

                                      RegExp
                                      Array
                                      Math

                                      Date
                                      Boolean
                                   Each of the above objects hold several built-in functions to perform object related functionality.
                                   Apart from these methods, Javascript provides few predefined functions which do not stick to a
                                   particular object type but are global.









          100                               LOVELY PROFESSIONAL UNIVERSITY
   102   103   104   105   106   107   108   109   110   111   112