Page 138 - DCAP202_Fundamentals of Web Programming
P. 138

Unit 10: Browser Objects




          The following example specified that text in blockquotes is to be blue:               Notes
          document.contextual(document.tags.blockquote).color = “blue”;
          Multiple styles may be specified in the contextual method to set the value of text in a H3 tag that
          is underlined to the color blue, for example.
          document.contextual(document.tags.H3, document.tags.U).color = “blue”;
              elementFromPoint(x, y) - Returns the object at point x, y in the HTML document.
              getSelection() - Get the selected text (if any is selected).

              open([mimeType]) - Opens a new document object with the optional MIME type.
              write(expr1[,expr2...exprN]) - Add data to a document. Writes the values passed to the
               write function to the document.

               document.write(“<H3>”) document.writeln(“This is a Header”) document.write(“</H3>”)
              writeln(expr1[,expr2...exprN]) - Adds the passed values to the document appended with a
               new line character.

          Self Assessment

          Fill in the blanks:

          13.  The JavaScript ........................... is the container for all HTML HEAD and BODY objects
               associated within the HTML tags of an HTML document.
          14.  ........................... property sets the background color of the web page.

          15.  ........................... property specifies the text color attribute set in the <body> tag.

          10.6 Summary

              All browsers are split into different parts (objects) that can be accessed using Javascript.

              The window object, which is a top-level object in Client Side  JavaScript, represents a
               window or a frame (within a frameset).
              For a top-level window, the parent and top properties refer to the window itself.

              A window object is opened with window.open() and closed with window.close(), if the
               window does not refer to a frame.
              The JavaScript History Object is property of the window object.

              The JavaScript Document object is the container for all HTML HEAD and BODY objects
               associated within the HTML tags of an HTML document.
              Navigator Objects contains information about the version, mimetype and what plug-ins
               users have installed of Navigator in use.
              The JavaScript location object is a property of the window object. It can be used to control
               the web page displayed by the browser.

          10.7 Keywords


          contextual(): It can be used to specify stype of specific tags.
          Cookie: This property is used to identify the value of a cookie.



                                           LOVELY PROFESSIONAL UNIVERSITY                                   131
   133   134   135   136   137   138   139   140   141   142   143