YAHOO.widget.Module
Module Example
A Module is an object representation of Yahoo!'s Standard Module Format. A Module can optionally contain three elements (but must include at least one): a header, a body, and a footer, each which are denoted by CSS classes: "hd", "bd", and "ft" respectively. An empty module would look like this:
Modules can be constructed by attaching the Module object to pre-existing markup, or dynamically creating them from scratch and appending them to the DOM. The code to create a Module around that markup would look as simple as this:
myModule = new YAHOO.widget.Module("myModule");
A Module can be dynamically created by passing the arbitrary ID of the Module to create into the constructor, setting some content, and rendering the Module using the render method, passing in the node that the Module should be appended to, as in this example:
myDynamicModule = new YAHOO.widget.Module("myDynamicModule");
myDynamicModule.setBody("Here's some body content.");
myDynamicModule.render(document.getElementById("dynamic"));
Here are some example modules, including the one from above:
Predefined Module Header
I was created using simple predefined markup.
Predefined Module Footer
Placeholder Header
This is only placeholder text in the markup.
Placeholder Footer
yui.zip( 3,714 k)