HTML Learning Document-4, HTML properties

Source: Internet
Author: User
Tags html form

4.1 HTML Global Properties
Property Describe
AccessKey Specifies the shortcut key for activating an element.
Class Specifies one or more class names for an element (referencing a class in a style sheet).
Contenteditable Specifies whether the element content can be edited.
ContextMenu The context menu for the specified element. The context menu is displayed when the user clicks on an element.
data-* Private custom data that is used to store pages or applications.
Dir Specifies the text direction of the content in the element.
Draggable Specifies whether the element can be dragged.
Dropzone Specifies whether to copy, move, or link while dragging the data that is being dragged.
Hidden The specified element is still not or is no longer relevant.
Id The unique ID of the specified element.
Lang The language that specifies the content of the element.
SpellCheck Specifies whether to check spelling and grammar of elements.
Style The inline CSS style for the specified element.
TabIndex Specifies the tab order of the elements.
Title Specifies additional information about the element.
Translate Specifies whether the element content should be translated.
4.2 Window Event Properties

Events triggered for the Window object (applied to <body> tags):

Property Value Describe
Onafterprint Script A script that runs after the document is printed.
Onbeforeprint Script A script that runs before the document is printed.
onBeforeUnload Script The script that runs before the document is unloaded.
OnError Script A script that runs when an error occurs.
Onhaschange Script The script that runs when the document has changed.
OnLoad Script Triggered after the page finishes loading.
OnMessage Script The script that runs when the message is triggered.
Onoffline Script A script that runs when the document is offline.
Ononline Script The script that runs when the document is online.
Onpagehide Script The script that runs when the window is hidden.
Onpageshow Script The script that is run when the window becomes visible.
Onpopstate Script The script that runs when the window history changes.
Onredo Script The script that is run when the document is executed for revocation (redo).
OnResize Script triggered when the browser window is resized.
Onstorage Script Scripts that run after the Web Storage zone is updated.
OnUndo Script The script that runs when the document executes undo.
OnUnload Script Triggered once the page has been downloaded (or the browser window has been closed).
4.3 Form Event Properties

Events triggered by actions within an HTML form (applied to almost all HTML elements, but most commonly in form elements)

Property Value Describe
Onblur Script The script that runs when the element loses focus.
OnChange Script A script that runs when the element value is changed.
OnContextMenu Script The script that is run when the context menu is triggered.
onfocus Script The script that runs when the element gets focus.
Onformchange Script A script that runs when the form changes.
Onforminput Script The script that is run when the form obtains user input.
Oninput Script The script that is run when the element obtains user input.
Oninvalid Script The script to run when the element is invalid.
OnReset Script triggered when the reset button in the form is clicked. Not supported in HTML5.
Onselect Script triggered when the text in the element is selected.
OnSubmit Script Triggered when the form is submitted.
onfocus Script The script that runs when the element gets focus.
Onformchange Script A script that runs when the form changes.
Onforminput Script The script that is run when the form obtains user input.
Oninput Script The script that is run when the element obtains user input.
Oninvalid Script The script to run when the element is invalid.
4.4 Keyboard Event Properties

Events triggered by a keyboard or similar user action

Property Value Describe
OnKeyDown Script Triggered when the user presses the key.
onkeypress Script Triggered when the user taps the button.
OnKeyUp Script Triggered when the user releases the key.

4.5 Mouse Event Properties

Events triggered by a mouse or similar user action:

Property Value Describe
OnClick Script triggered when a mouse click occurs on an element.
OnDblClick Script triggered when a mouse double-click occurs on an element.
Ondrag Script The script that is run when the element is dragged.
Ondragend Script A script that runs at the end of a drag operation.
OnDragEnter Script A script that runs when an element has been dragged into a valid drop area.
OnDragLeave Script The script that runs when the element leaves a valid drag-and-drop target.
OnDragOver Script The script that runs when the element is being dragged on a valid drag-and-drop target.
Ondragstart Script The script that runs at the beginning of the drag operation.
OnDrop Script The script that is run when the dragged element is being dragged and dropped.
OnMouseDown Script triggered when the mouse button is pressed on the element.
OnMouseMove Script triggered when the mouse pointer moves over an element.
onmouseout Script triggered when the mouse pointer moves out of the element.
onmouseover Script triggered when the mouse pointer moves over an element.
OnMouseUp Script triggered when the mouse button is released on the element.
OnMouseWheel Script The script that runs when the mouse wheel is being scrolled.
Onscroll Script The script that is run when the element scroll bar is scrolled.
4.6 Media Events

Events triggered by media (such as video, image, and audio) (for all HTML elements, but common in media elements such as <audio>, <embed>, , <object>, and <video >)

Property Value Describe
Onabort Script The script to run on exit.
Oncanplay Script A script that runs when the file is ready to start playing (when the buffer is sufficient to start).
Oncanplaythrough Script A script that runs when the media is able to play to the end without having to stop because of buffering.
Ondurationchange Script A script that runs when the medium length changes.
Onemptied Script A script that runs when a failure occurs and the file is suddenly unavailable (such as when the connection is accidentally disconnected).
onended Script A script that runs when the media has reached the end (a message similar to "thank-you-watch" can be sent).
OnError Script The script that is run when an error occurs during file load.
Onloadeddata Script The script that runs when the media data is loaded.
Onloadedmetadata Script Scripts that run when metadata (such as resolution and duration) is loaded.
Onloadstart Script A script that runs before the file starts to load and does not actually load any data.
OnPause Script A script that runs when the media is paused by the user or program.
Onplay Script The script that runs when the media is ready to start playback.
Onplaying Script The script that runs when the media has started playing.
OnProgress Script The script that runs when the browser is acquiring media data.
Onratechange Script Scripts that run whenever the playback rate changes (such as when the user switches to slow or fast forward mode).
onReadyStateChange Script Scripts that run whenever the readiness state changes (readiness State monitors the state of the media data).
Onseeked Script The script that runs when the seeking property is set to False (indicating that the location has ended).
Onseeking Script The script that runs when the seeking property is set to True (indicating that positioning is active).
Onstalled Script A script that runs when the browser fails to retrieve media data for whatever reason.
Onsuspend Script A script that runs when the media data is terminated for whatever reason before the medium data is fully loaded.
Ontimeupdate Script A script that runs when the playback position changes, such as when the user is fast-forward to a different location in the media.
Onvolumechange Script A script that runs whenever the volume changes, including setting the volume to mute.
Onwaiting Script Run the script when the media has stopped playing but intends to continue playing (such as when the media pauses to buffer more data)
4.7 Note

The ① property always appears in the form of a name/value pair, such as name= "value".

The ② property is always specified in the start tag of the HTML element.

③ attribute Instance

<a href= "http://www.w3school.com.cn" >this is a link</a> the address of the link is specified in the href attribute

<H1 align= "Center" >align defining the beginning of the title

<body bgcolor= "Yellow" >bgcolor defines the background color of the body of the HTML document

<table border= "1" > Border define Table borders

④html tip: Use lowercase attributes

⑤ always quotes the attribute value, and in some cases, such as the attribute value itself contains double quotes, you must use single quotation marks, for example:

Name= ' Bill ' HelloWorld ' Gates '

HTML Learning Document-4, HTML properties

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.