HTML5 structure and semantics (5): Interactive _ html5 tutorial skills-

Source: Internet
Author: User
Www.webjx.comhtml_xhtml20080306html_xhtml_4688.html HTML5 is also known as WebApplications1.0. To achieve this, several new elements are added to provide an interactive experience for Web pages: detailsdatagridmenucommand these elements can be based on the user's http://www.jb51.net/html_xhtml/20080306/html_xhtml_4688.html
HTML 5 is also known as Web Applications 1.0. To achieve this goal, several new elements are added to provide interactive experience for Web pages:
Details
Datagrid
Menu
Command
These elements can be changed based on user operations and selection, without loading a new page from the server.
Details
The details element indicates details that may not be displayed by default. The optional legend element provides a summary of detailed information.
One of the purposes of the details element is to provide the footer and end note. For example:
The bill of a Craveri's Murrelet is about 10% thinner
Than the bill of a Xantus's Murrelet.

[Sibriley, 2000]

Sibley, David Allen, The Sibley Guide to Birds,
(New York: Chanticleer Press, 2000) p. 247



No specific display method is specified. You can use footer, tail injection, and tooltip in the browser.
Each details element can have an open attribute. If this attribute is set, the detailed information is displayed at the beginning. If this attribute is not set, it will be hidden until the user asks to display them. In either case, you can click an icon or another control to display or hide details.
Datagrid
The datagrid element provides a grid control. You can use it to display trees, lists, and tables. Users and scripts can update these interface elements. In contrast, traditional tables are mainly used to display static data.
The datagrid obtains initial data from its content (a table, select, or other HTML elements. For example, the datagrid in code 9 contains a two-dimensional table. In this example, the data of the datagrid comes from a table. A simpler one-dimensional datagrid can obtain data from the select element. If other HTML elements are used, each child element becomes a row in the grid.






Jones Allison A- B A
Smith Johnny A C A
Willis Sysydney C- D F
Wilson Frank B- B A


This element differs from a regular table in that you can select rows, columns, and cells, fold rows, columns, and cells, edit cells, and delete rows, columns, and cells; sort the grids, and perform other data operations directly in the client browser. You can use JavaScript code to monitor updates. The HTMLDataGridElement interface is added to the Document Object Model (DOM) to support this element (Code 10 HTMLDataGridElement ).
Interface HTMLDataGridElement: HTMLElement {
Attribute DataGridDataProvider data;
Readonly attribute DataGridSelection selection;
Attribute boolean multiple;
Attribute boolean disabled;
Void updateEverything ();
Void updateRowsChanged (in RowSpecification row, in unsigned long count );
Void updateRowsInserted (in RowSpecification row, in unsigned long count );
Void updateRowsRemoved (in RowSpecification row, in unsigned long count );
Void updateRowChanged (in RowSpecification row );
Void updateColumnChanged (in unsigned long column );
Void updateCellChanged (in RowSpecification row, in unsigned long column );
};
You can also use DOM to dynamically load data in the mesh. That is to say, the datagrid can not contain child elements that provide initial data. You can use a DataGridDataProvider object to set it (Code 11 DataGridDataProvider ). In this way, you can load data from any resource that can be accessed by the database, XmlHttpRequest, or JavaScript code.
Interface DataGridDataProvider {
Void initialize (in HTMLDataGridElement datagrid );
Unsigned long getRowCount (in RowSpecification row );
Unsigned long getChildAtPosition (in RowSpecification parentRow,
In unsigned long position );
Unsigned long getColumnCount ();
DOMString getCaptionText (in unsigned long column );
Void getCaptionClasses (in unsigned long column, in DOMTokenList classes );
DOMString getRowImage (in RowSpecification row );
HTMLMenuElement getRowMenu (in RowSpecification row );
Void getRowClasses (in RowSpecification row, in DOMTokenList classes );
DOMString getCellData (in RowSpecification row, in unsigned long column );
Void getCellClasses (in RowSpecification row, in unsigned long column,
In DOMTokenList classes );
Void toggleColumnSortState (in unsigned long column );
Void setCellCheckedState (in RowSpecification row, in unsigned long column,
In long state );
Void cycleCell (in RowSpecification row, in unsigned long column );
Void editCell (in RowSpecification row, in unsigned long column, in DOMString data );
};
Menu and command
The menu element actually appears in HTML 2. It is discarded in HTML 4, but HTML 5 restores it and specifies a new meaning. In HTML 5, the menu contains the command element, and each command element triggers an operation. For example, the Code 12 HTML 5 menu is a pop-up warning box menu.





You can also use the checked = "checked" attribute to convert commands to check boxes. By specifying the radiogroup attribute, you can convert the check box to a single-choice button. The value of this attribute is the group name of the mutually exclusive button.
In addition to a simple command list, you can also use the menu element to create a toolbar or pop-up context menu. You need to set the type attribute to toolbar or popup. For example, the Code 13. HTML 5 toolbar displays a toolbar similar to the blog editor such as WordPress. It uses the icon attribute to link to the button image.
















The label attribute provides the menu title. For example, Code 14. HTML 5 shows an Edit menu in the Edit menu.








Menus can be nested in other menus to form a hierarchical menu structure.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.