Page 126 - DCAP202_Fundamentals of Web Programming
P. 126

Unit 9: DOM Model




          9.2.3 Element Object                                                                  Notes

          The following properties, and methods can be used on all HTML elements.




             Notes  All elements can also use the properties/methods of the Node object and the Element
             object.

          Properties


              Property                        Description                      W3C
           accessKey     Sets or returns an accesskey for an element            Yes
           className     Sets or returns the class attribute of an element      Yes
                         Returns  the  viewable  height  of  the  content  on  a  page  (not
           clientHeight                                                         No
                         including borders, margins, or scrollbars)
                         Returns  the  viewable  width  of  the  content  on  a  page  (not
           clientWidth                                                          No
                         including borders, margins, or scrollbars)
           dir           Sets or returns the text direction of an element       Yes
           id            Sets or returns the id of an element                   Yes
           innerHTML     Sets or returns the HTML contents (+text) of an element   Yes
           lang          Sets or returns the language code for an element       Yes
                         Returns  the  height  of  an  element,  including  borders  and
           offsetHeight                                                         No
                         padding if any, but not margins
                         Returns  the  horizontal  offset  position  of  the  current  element
           offsetLeft                                                           No
                         relative to its offset container
           offsetParent   Returns the offset container of an element            No

                         Returns  the  vertical  offset  position  of  the  current  element
           offsetTop                                                            No
                         relative to its offset container
                         Returns  the  width  of  an  element,  including  borders  and
           offsetWidth                                                          No
                         padding if any, but not margins
                         Returns the entire height of an element (including areas hidden
           scrollHeight                                                         No
                         with scrollbars)
                         Returns the distance between the actual left edge of an element
           scrollLeft                                                           No
                         and its left edge currently in view
                         Returns the distance between the actual top edge of an element
           scrollTop                                                            No
                         and its top edge currently in view
                         Returns the entire width of an element (including areas hidden
           scrollWidth                                                          No
                         with scrollbars)
           style         Sets or returns the style attribute of an element      Yes
           tabIndex      Sets or returns the tab order of an element            Yes

           title         Sets or returns the title attribute of an element      Yes







                                           LOVELY PROFESSIONAL UNIVERSITY                                   119
   121   122   123   124   125   126   127   128   129   130   131