Page 183 - Web Applications (803) Class 12
P. 183

2.  Both the client side and the server side of a script can use JavaScript: JavaScript has access to the
                    browser’s Document Object Model (DOM). Web page structures are modifiable in real time. JavaScript can
                    therefore be used to give webpages a variety of effects. JavaScript, on the other hand, may be applied to
                    the server side as well.
                 3.  Use of Functions for Programming: Functions can be assigned to variables in JavaScript just like any
                    other datatype. A function can return a function and receive another function as an argument. Functions
                    without names are also possible.
                 4.  Assistance with Objects: Most object-oriented ideas are supported by JavaScript, which are easy to learn
                    and use.

                 5.  Object Type and instantiation: JavaScript enables both predefined and user-defined objects and the
                    generation of object types. Any object of any type can be assigned to any variable. The defined object types
                    can be instantiated to produce object instances, an incredibly potent feature of object-based languages, in
                    JavaScript.
                    The object types in JavaScript are specified by their properties and methods. To retrieve the data values
                    stored in an object, use its properties. Depending on the type of object, you can utilise the properties of
                    JavaScript objects for both reading and editing. In other words, using methods that utilise the object’s
                    properties allows you to perform functions on the object.

                 These are a few of the characteristics that enable JavaScript to handle both straightforward and complicated
                 tasks. As a result, JavaScript has long held the title of most widely used programming language. Because it
                 supports both object-oriented and function principles, it is also a useful language for web designers who
                 want to learn computer programming. All you need to use it is a browser and a text editor.

                 Writing Scripts in JavaScript

                 Typically, JavaScript code is incorporated into HTML so that the client’s
                 browser can interpret and execute it. The following advice should be
                 kept in mind when constructing JavaScript instructions:
                   White space between words and tabs is disregarded in JavaScript
                    code.
                   It is case sensitive.
                   Line  breaks are  not  taken  into  account  unless they  are  part  of  a
                    statement.

                   JavaScript statements conclude with a semicolon (;)

                 The Script Tag
                 JavaScript is typically embedded into an HTML document using the <script> tag. The script tag notifies the
                 browser of the start and end of the scripting language for HTML documents.  The general attributes of the
                 script tag are:
                   src: Defines the address of the external file. This can be an absolute URL or a relative URL

                   type: Defines the MIME type of the script.
                   charset: Defines the character encoding of the external JavaScript file.






                                                                                          Web Scripting—JavaScript   181
   178   179   180   181   182   183   184   185   186   187   188