Thursday, 22 December 2011

New Global attributes in HTML5


 New global attributes in HTML5.
AttributeValueDescription
accesskeycharacterSpecifies a shortcut key to access an element
classclassnameRefers to a class specified in a style sheet
contenteditableNewtrue
false
inherit
Specifies whether a user can edit the content of an element or not
contextmenuNewmenu_idSpecifies a context menu for an element. The value must be the id of a <menu> element
dirltr
rtl
auto
Specifies the text direction for the content in an element
draggableNewtrue
false
auto
Specifies whether a user is allowed to drag an element or not
dropzoneNewcopy
move
link
Specifies what happens when dragged items/data is dropped in the element
hiddenNewhiddenSpecifies that an element should be hidden
ididSpecifies a unique id for an element
langlanguage_codeSpecifies the language of the element's content
spellcheckNewtrue
false
Specifies if the element must have its spelling and grammar checked
stylestyle_definitionsSpecifies an inline style for an element
tabindexnumberSpecifies the tab order of an element
titletextSpecifies extra information about an element

HTML5 Global Event Attributes

HTML 4 added the ability to let events trigger actions in a browser, like starting a JavaScript when a user clicks on an element.
Below are the global event attributes that can be added to HTML5 elements to define event actions
New : New event attributes in HTML5.

Window Event Attributes

Events triggered for the window object (applies to the <body> tag):
AttributeValueDescription
onafterprintNewscriptScript to be run after the document is printed
onbeforeprintNewscriptScript to be run before the document is printed
onbeforeonloadNewscriptScript to be run before the document loads
onblurscriptScript to be run when the window loses focus
onerrorNewscriptScript to be run when an error occur
onfocusscriptScript to be run when the window gets focus
onhaschangeNewscriptScript to be run when the document has changed
onloadscriptScript to be run when the document loads
onmessageNewscriptScript to be run when the message is triggered
onofflineNewscriptScript to be run when the document goes offline
ononlineNewscriptScript to be run when the document comes online
onpagehideNewscriptScript to be run when the window is hidden
onpageshowNewscriptScript to be run when the window becomes visible
onpopstateNewscriptScript to be run when the window's history changes
onredoNewscriptScript to be run when the document performs a redo
onresizeNewscriptScript to be run when the window is resized
onstorageNewscriptScript to be run when the document loads
onundoNewscriptScript to be run when the document performs an undo
onunloadNewscriptScript to be run when the user leaves the document


Form Events

Events triggered by actions inside a HTML form (applies to all HTML5 elements, but is most common in form elements):
AttributeValueDescription
onblurscript Script to be run when an element loses focus
onchangescriptScript to be run when an element changes
oncontextmenuNewscript Script to be run when a context menu is triggered
onfocusscript Script to be run when an element gets focus
onformchangeNewscript Script to be run when a form changes
onforminputNewscript Script to be run when a form gets user input
oninputNewscript Script to be run when an element gets user input
oninvalidNewscript Script to be run when an element is invalid
onresetscript Script to be run when a form is reset
Not supported in HTML5
onselectscript Script to be run when an element is selected
onsubmitscriptScript to be run when a form is submitted



No comments:

Post a Comment