Class Body


public final class Body extends StyledContainerElement<Body>
Represents an HTML <body> element containing the document's content.

The Body element contains all the visible contents of an HTML document. There can be only one <body> element in a document. This implementation automatically sets the ID to "body" and provides methods for scroll and load event handling.

Features:

  • Container for all visible document content
  • Automatic ID assignment ("body")
  • Scroll and scroll-end event support
  • onLoad event handler support
  • Full CSS styling capabilities

Usage:


 Body body = new Body();
 body.setOnLoad("init()");
 body.setOnScroll("true");
 body.addChild(new Div("Content"));
 
Since:
2007
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Html
  • invalid reference
    StyledElement
  • Constructor Details

    • Body

      public Body()
      Constructs a <body> element with ID set to "body".
  • Method Details

    • setOnScroll

      public final void setOnScroll(String value)
      Enables scroll event generation for this body element.
      Overrides:
      setOnScroll in class VisualElement<Body>
      Parameters:
      value - triggers scroll event generation (value is ignored, presence enables feature)
    • setOnScrollEnd

      public final void setOnScrollEnd(String value)
      Enables scroll-end event generation for this body element.
      Overrides:
      setOnScrollEnd in class VisualElement<Body>
      Parameters:
      value - triggers scroll-end event generation (value is ignored, presence enables feature)
    • setOnLoad

      public final void setOnLoad(String value)
      Sets the JavaScript code to execute when the page finishes loading.
      Overrides:
      setOnLoad in class Element<Body>
      Parameters:
      value - the JavaScript code or function call