onwaiting Event
Example
Execute a JavaScript when the video stops because it needs to buffer the next frame: <video onwaiting="myFunction()">
Open in separate window
View full source code <html> <body> <p>This example demonstrates how to assign an "onwaiting" event to a video element.</p> <p>Play the video.</p> <video controls onwaiting="myFunction()"> <source src="radian.mp4" type="video/mp4"> <source src="radian.ogg" type="video/ogg"> Your browser does not support HTML5 video. </video><!-- w w w . d e m o 2s . c o m--> <p id='demo'></p> <script> function myFunction() { document.getElementById('demo').innerHTML = "need to buffer the next frame"; } </script> </body> </html>Description
The onwaiting event occurs when the video stops because it needs to buffer the next frame. This event can also be used on <audio> elements and <video> elements.Browser Compatibility
onwaiting
| Yes | Yes | Yes | Yes | Yes | Yes |
Item | Value |
---|---|
Bubbles: | No |
Cancelable: | No |
Event type: | Event |
Supported HTML tags: | <audio>, <video> |
DOM Version: | Level 3 Events |
onwheel
| Yes | Yes | Yes | Yes | Yes | Yes |
Item | Value |
---|---|
Bubbles: | Yes |
Cancelable: | Yes |
Event type: | WheelEvent |
Supported HTML tags: | All HTML elements |
DOM Version: | Level 3 Events |
Property | Description |
---|---|
accessKey | gets and sets the accesskey attribute of an element |
attributes | Get all attributes |
childElementCount | count child Element |
childNodes | Get all child Nodes |
children | get children elements |
classList | get style class List |
className | gets and sets the class name |
clientHeight | get viewable Height |
clientLeft | get viewable Left position |
clientTop | get viewable Top position |
clientWidth | get viewable Width |
contentEditable | gets and sets whether an element is editable or not |
dir | gets and sets the dir attribute of an element |
firstChild | Get first Child Node |
firstElementChild | get first Element Child |
id | Get and Set id Property |
innerHTML | Get and Set HTML content |
innerText | Get element content as Text |
isContentEditable | Check if an element is editable or not |
lang | Get and Set element language Property |
lastChild | Get last Child |
lastElementChild | get last Element Child |
length | Get Element child element count/length Property |
namespaceURI | Get and Set namespace URI |
nextElementSibling | get next Element Sibling |
nextSibling | Get next Sibling element |
nodeName | Get node Name |
nodeType | Get node Type |
nodeValue | Get and Set node Value |
offsetHeight | get offset Height |
offsetLeft | get offset Left on screen |
offsetParent | get offset Parent position on screen |
offsetTop | get offset top position |
offsetWidth | get offset Width on screen |
outerHTML | Get and Set Element HTML and its children |
outerText | Get and Set text value via outer txt |
ownerDocument | Get parent Document |
parentElement | Get parent Element |
parentNode | Get parent Node |
previousElementSibling | get previous Element Sibling element |
previousSibling | Get previous Sibling node |
scrollHeight | get Height in scrolling |
scrollLeft | get scrolled Left position |
scrollTop | get scrolled Top position |
scrollWidth | get scrolled Width |
style | Get and Set style Property |
tabIndex | Get and Set tab Index Property |
tagName | get tag Name |
textContent | Get and Set text Content |
title | Get and Set title Property |
Method | Description |
---|---|
addEventListener() | add Event Listener |
appendChild() | append Child element |
blur() | remove focus from an element |
click() | simulates a mouse-click on an element |
cloneNode | clone Node |
closest() | Get closest element by CSS selector |
compareDocumentPosition | compare Document Position |
contains() | Check if element contains another element |
exitFullscreen() | exit Full screen mode |
focus() | grab focus |
getAttribute() | get Attribute by name |
getAttributeNode() | get Attribute Node by name |
getBoundingClientRect() | get Bounding Client Rectangle |
getElementsByClassName() | get children Elements By Class Name |
getElementsByTagName() | get children Elements By Tag Name |
hasAttribute() | check Attribute existence by name |
hasAttributes | Check if element has a certain Attribute |
hasChildNodes | Check if element has Child Nodes |
insertAdjacentElement() | insert Adjacent Element |
insertAdjacentHTML() | insert HTML |
insertAdjacentText() | insert text node |
insertBefore | insert node Before |
isDefaultNamespace | Check if element has Default Namespace |
isEqualNode | is Equal to another Node |
isSameNode | is Same Node with another element |
isSupported | Check if element is Supported a feature |
matches() | matches children elements by CSS selector |
normalize | normalize element content |
querySelector() | get children elements via CSS Selector |
querySelectorAll() | Get all children elements by CSS Selector |
remove | remove element from DOM tree |
removeAttribute() | remove Attribute by name |
removeAttributeNode() | remove Attribute Node by name |
removeChild | remove Child element node |
removeEventListener() | remove Event Listener |
replaceChild | replace Child element |
requestFullscreen() | request Full screen mode |
scrollIntoView() | scroll Into visible |
setAttribute() | set Attribute |
setAttributeNode() | set Attribute Node |
Property | Description |
---|---|
activeElement | Get currently focused element in the document |
addEventListener() | attaches an event handler to the document |
baseURI | returns the base URI of the HTML document |
body | gets and sets the document's body |
cookie | gets and sets cookies in the current document |
characterSet | Get the character encoding for the document |
createAttribute() | creates an attribute |
createDocumentFragment() | creates an imaginary Node object |
defaultView | Get the document's Window Object |
designMode | gets and sets whether the document is editable or not |
doctype | Get doctype of HTML document as a DocumentType object |
documentElement | Get documentElement of the document as Element object |
documentURI | gets and sets the location of a document |
domain | Get the domain name that loaded the current document |
fullscreenElement | Get the current element displayed in full screen mode |
head | Get <head> element of the current document. |
lastModified | Get last Modified time |
readyState | Check if document is loaded |
referrer | Get URL of the document that loaded the current document |
title | Get document title Property |
URL | Get full URL of the current HTML document |
implementation | Get implementation information |
inputEncoding | Get character encoding for the document |
strictErrorChecking | Get strict Error Checking Property |
Method | Description |
---|---|
adoptNode() | adopts a node from another document |
close() | closes the output stream |
createComment() | create Comment node |
createElement() | create Element Node |
createEvent() Event | create Event Object |
createTextNode() | create Text Node |
execCommand() | executes command for an editable section |
fullscreenEnabled() | Check if fullscreen mode is Enabled |
getElementById() | finds the element by its ID attribute value |
getElementsByClassName() | Get a collection of all elements |
getElementsByTagName() | Get all elements from document with the specified tag name |
getElementsByName() | Get all elements with the specified name |
hasFocus() | Check whether the document or any children element has focus |
importNode() | imports a node from another document |
normalize | normalize element and text node |
normalizeDocument() | normalize Document |
querySelector() | Get elements by CSS selector(s) |
querySelectorAll() | Get all elements from CSS selector(s) |
removeEventListener() | remove Event Listener |
renameNode() | rename Node |
open() | opens an output stream |
write() | writes HTML expressions |
writeln() | writes HTML expressions with new line character |
Collection | Description |
---|---|
anchors Collection | Document Get anchors Collection |
applets Collection | Document Get applets Collection |
embeds Collection | Document Get embeds Collection |
forms Collection | Document Get forms Collection |
images Collection | Document Get images Collection |
links Collection | Document Get links Collection |
scripts Collection | Document Get scripts Collection |
Property / Method | Description |
---|---|
isId | Returns true if the attribute is of type Id, otherwise it returns false |
name | Returns the name of an attribute |
value | gets or sets the value of the attribute |
specified | Returns true if the attribute has been specified, otherwise it returns false |
getNamedItem() | Returns a specified attribute node from a NamedNodeMap |
item() | Returns the attribute node at a specified index in a NamedNodeMap |
length | Returns the number of attribute nodes in a NamedNodeMap |
removeNamedItem() | Removes a specified attribute node |
setNamedItem() | Sets the specified attribute node (by name) |
Property / Method | Description |
---|---|
item() | Returns the element at the specified index in an HTMLCollection |
length | Returns the number of elements in an HTMLCollection |
namedItem() | Returns the element with the specified ID, or name, in an HTMLCollection |
Collections | Description |
---|---|
cells | Table Get cells Collection |
rows | Table Get rows Collection |
tBodies | Table Get tBodies Collection |
cells | Table Get cells Collection |
Property | Description |
---|---|
caption | DOM Table Get and Set caption table title Property |
tFoot | DOM Table Get and Set table Foot Property |
tHead | DOM Table Get and Set table Head Property |
Method | Description |
---|---|
createCaption() | Table create Caption Method |
createFoot() | Table create table Foot Method |
createHead() | Table create Table Head Method |
deleteCaption() | Table delete table title Caption Method |
deleteRow() | Table delete Row Method |
deleteFoot() | Table delete Table Foot Method |
deleteHead() | Table delete Table Head Method |
insertRow() | Table insert Row Method |
Property | Description |
---|---|
cellIndex | TableData Get and Set cell Index Property |
colSpan | TableData Get and Set column Span Property |
headers | TableData Get and Set headers collection Property |
rowSpan | TableData Get and Set row Span Property |
Property | Description |
---|---|
autofocus | Textarea Get and Set auto focus Property |
cols | Textarea Get and Set column size Property |
defaultValue | Textarea Get and Set default Value Property |
disabled | Textarea enable and disable text area box |
form | Textarea Get form Property |
maxlength | Textarea Get and Set max Length Property |
name | Textarea Get and Set name Property |
placeholder | Textarea Get and Set placeholder Property |
readonly | Textarea Get and Set readOnly Property |
required | Textarea Get and Set required Property |
rows | Textarea Get and Set row size Property |
type | Textarea Get and Set type Property |
value | Textarea Get and Set value Property |
wrap | Textarea Get and Set wrap Property |
Method | Description |
---|---|
select() | select all text |
Property | Description |
---|---|
abbr | Javascript DOM TableHeader Get and Set abbreviation Property |
cellIndex | Javascript DOM TableHeader Get and Set cell Index Property |
colSpan | Javascript DOM TableHeader Get and Set column Span Property |
headers | Javascript DOM TableHeader Get and Set headers collection Property |
rowSpan | Javascript DOM TableHeader Get and Set row Span Property |
Property | Description |
---|---|
dateTime | Time Get and Set date Time Property |
Property | Description |
---|---|
text | Title Get and Set text Property |
Property | Description |
---|---|
rowIndex | DOM TableRow Get and Set row Index Property |
sectionRowIndex | DOM TableRow Get and Set row section Index Property |
Method | Description |
---|---|
deleteCell() | DOM TableRow delete Cell Method |
insertCell() | DOM TableRow insert Cell Method |
Property | Description |
---|---|
default | Track Get and Set default value Property |
kind | Track Get and Set kind Property |
label | Track Get and Set label Property |
readyState | Track Get and Set ready State Property |
src | Track Get and Set source url Property |
srclang | Track Get and set source lang Property |
Property | Description |
---|---|
audioTracks | Video Get and Set audio Tracks Property |
autoPlay | Video Get and Set auto play Property |
buffered | Video Get and Set if to buffer video |
controller | Video Get and Set controller object |
controls | Video Show and hide controls panel |
currentSrc | Video Get and Set current source url Property |
currentTime | Video Get and Set current played Time Property |
muted | Video Get and Set default Muted state |
defaultPlaybackRate | Video Get and Set default Playback Rate Property |
duration | Video Get and Set duration Property |
ended | Video Get and Set ended state |
error | Video Get error Property |
height | Video Get and Set height Property |
loop | Video Get and Set loop Property |
mediaGroup | Video Get and Set media Group Property |
muted | Video Get and Set muted state |
networkState | Video Get network State Property |
paused | Video Get and Set paused state |
playbackRate | Video Get and Set playback Rate Property |
played | Video Check if played Property |
poster | Video Get and Set poster image Property |
preload | Video Get and Set preload flag |
readyState | Video Get ready State Property |
seekable | Video Get seekable Property |
seeking | Video Get seeking state Property |
src | Video Get and Set source url |
startDate | Video Get and Set start Date Property |
textTracks | Video Get and Set text Tracks Property |
videoTracks | Video Get and Set video Tracks Property |
volume | Video Get and Set volume Property |
width | Video Get and Set width Property |
Property | Description |
---|---|
addTextTrack() | Video add Text Track Method |
checkPlayableType() | Video check Playable Type Method |
load() | Video load video Method |
pause() | Video pause video Method |
play() | Video play video Method |
Property | Description |
---|---|
cssText | Get and Set css Text Property |
length | Get and Set number of style |
parentRule | Get and Set parent Rule Property |
item Method | Get style rule by index |
Method | Description |
---|---|
getPropertyPriority | get CSS Rule Priority |
getPropertyValue | get Style rule Property |
removeProperty | remove style rule Property |
setProperty | set rule Property |
top
| Yes | Yes | Yes | Yes | Yes | Yes |
Value | Description |
---|---|
auto | Lets the browser set the top position. This is default |
length | Defines the top position in length units. Negative values are allowed |
% | Sets the top position in % of the height of the parent element |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
transform
| Yes | Yes | Yes | Yes | Yes | Yes |
Value | Description |
---|---|
none | there should be no transformation |
matrix(n, n, n, n, n, n) | a 2D transformation, using a matrix of six values |
matrix3d(n, n, n, n, etc....) | a 3D transformation, using a 4x4 matrix of 16 values |
translate(x, y) | a 2D translation |
translate3d(x, y, z) | a 3D translation |
translateX(x) | a translation, using only the value for the X-axis |
translateY(y) | a translation, using only the value for the Y-axis |
translateZ(z) | a 3D translation, using only the value for the Z-axis |
scale(x, y) | a 2D scale transformation |
scale3d(x, y, z) | a 3D scale transformation |
scaleX(x) | a scale transformation by giving a value for the X-axis |
scaleY(y) | a scale transformation by giving a value for the Y-axis |
scaleZ(z) | a 3D scale transformation by giving a value for the Z-axis |
rotate(angle) | a 2D rotation, the angle is specified in the parameter |
rotate3d(x, y, z, angle) | a 3D rotation |
rotateX(angle) | a 3D rotation along the X-axis |
rotateY(angle) | a 3D rotation along the Y-axis |
rotateZ(angle) | a 3D rotation along the Z-axis |
skew(x-angle, y-angle) | a 2D skew transformation along the X- and the Y-axis |
skewX(angle) | a 2D skew transformation along the X-axis |
skewY(angle) | a 2D skew transformation along the Y-axis |
perspective(n) | a perspective view for a 3D transformed element |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
transformOrigin
| Yes | Yes | Yes | Yes | Yes | Yes |
Value | Description |
---|---|
x-axis | Defining where the view is placed at the x-axis. Possible values: "left" "center" "right" length in number % |
y-axis | Defining where the view is placed at the y-axis. Possible values: "top" "center" "bottom" length in number % |
z-axis | Defining where the view is placed at the z-axis (for 3D transforms). Possible values: length |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
transformStyle
| Yes | Yes | Yes | Yes | Yes | Yes |
Value | Description |
---|---|
flat | Default value. The child elements will NOT preserve its 3D position |
preserve-3d | The child elements will preserve its 3D position |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
transition
| Yes | Yes | Yes | Yes | Yes | Yes |
Value | Description |
---|---|
transitionProperty | the name of CSS property the transition effect is for |
transitionDuration | how many seconds(s) or milliseconds(ms) the transition effect takes to complete |
transitionTimingFunction | the speed curve of the transition effect |
transitionDelay | when the transition effect will start |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
transitionDelay
| Yes | Yes | Yes | Yes | Yes | Yes |
Value | Description |
---|---|
time | the number of seconds or milliseconds to wait before the transition effect will start |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
transitionDuration
| Yes | Yes | Yes | Yes | Yes | Yes |
Value | Description |
---|---|
time | how many seconds or milliseconds a transition effect takes to complete. Default value is 0, meaning there will be no effect |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
transitionProperty
| Yes | Yes | Yes | Yes | Yes | Yes |
Parameter | Description |
---|---|
none | No property will get a transition effect |
all | Default value. All properties will get a transition effect |
property | a comma separated list of CSS property names the transition effect is for |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
transitionTimingFunction
| Yes | Yes | Yes | Yes | Yes | Yes |
Value | Description |
---|---|
ease | Default value. a transition effect with a slow start, then fast, then end slowly equivalent to cubic-bezier(0.25, 0.1, 0.25, 1) |
linear | a transition effect with the same speed from start to end equivalent to cubic-bezier(0, 0, 1, 1) |
ease-in | a transition effect with a slow start equivalent to cubic-bezier(0.42, 0, 1, 1) |
ease-out | a transition effect with a slow end equivalent to cubic-bezier(0, 0, 0.58, 1) |
ease-in-out | a transition effect with a slow start and end equivalent to cubic-bezier(0.42, 0, 0.58, 1) |
cubic-bezier(n, n, n, n) | Define your own values in the cubic-bezier function. Possible values are numeric values from 0 to 1 |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
unicodeBidi
| Yes | Yes | Yes | Yes | Yes | Yes |
Value | Description |
---|---|
normal | Does not use an additional level of embedding. This is default |
embed | Creates an additional level of embedding |
bidi-override | Creates an additional level of embedding. Reordering depends on the direction property |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
userSelect
| Yes | Yes | Yes | Yes | Yes | Yes |
Parameter | Description |
---|---|
auto | Default. Text can be selected according to the browser's default settings |
none | Prevent text selection |
text | The text can be selected by the user |
all | Text selection is made with one click instead of a double-click |
verticalAlign
| Yes | Yes | Yes | Yes | Yes | Yes |
Value | Description |
---|---|
length | Raises or lower an element by the specified length. Negative values are allowed |
% | Raises or lower an element in a percent of the "line-height" property. Negative values are allowed |
baseline | Align the baseline of the element with the baseline of the parent element. This is default |
sub | Aligns the element as it was subscript |
super | Aligns the element as it was superscript |
top | The top of the element is aligned with the top of the tallest element on the line |
text-top | The top of the element is aligned with the top of the parent element's font |
middle | The element is placed in the middle of the parent element |
bottom | The bottom of the element is aligned with the lowest element on the line |
text-bottom | The bottom of the element is aligned with the bottom of the parent element's font |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
visibility
| Yes | Yes | Yes | Yes | Yes | Yes |
Parameter | Description |
---|---|
visible | The element is visible. This is default |
hidden | The element is not visible, but still affects layout |
collapse | When used on a table row or cell, the element is not visible same as "hidden" |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
whiteSpace
| Yes | Yes | Yes | Yes | Yes | Yes |
Parameter | Description |
---|---|
normal | Sequences of whitespace will collapse into a single whitespace. Text will wrap when necessary. This is default |
nowrap | Sequences of whitespace will collapse into a single whitespace. Text will not wrap to the next line. The text continues on the same line until a <br> tag is encountered |
pre | Whitespace is preserved by the browser. Text will only wrap on line breaks. Acts like the <pre> tag in HTML |
pre-line | Sequences of whitespace will collapse into a single whitespace. Text will wrap when necessary, and on line breaks |
pre-wrap | Whitespace is preserved by the browser. Text will wrap when necessary, and on line breaks |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
Value | Description |
---|---|
number | An integer that specifies the minimum number of visible lines. Negative values are not allowed. The default value is 2 |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
width
| Yes | Yes | Yes | Yes | Yes | Yes |
Value | Description |
---|---|
auto | The browser sets the width. This is default |
length | Defines the width in length units |
% | Defines the width in % of the parent element |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
wordBreak
| Yes | Yes | Yes | Yes | Yes | Yes |
Value | Description |
---|---|
normal | Default value. Break words according to their usual rules |
break-all | Lines may break between any two letters |
keep-all | Breaks are prohibited between pairs of letters |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
WordSpacing
| Yes | Yes | Yes | Yes | Yes | Yes |
Value | Description |
---|---|
normal | Defines normal spacing between words. This is default |
length | the space between words in length units. Negative values are allowed |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
wordWrap
| Yes | Yes | Yes | Yes | Yes | Yes |
Parameter | Description |
---|---|
normal | Break words only at allowed break points |
break-word | Allows unbreakable words to be broken |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
zIndex
| Yes | Yes | Yes | Yes | Yes | Yes |
Value | Description |
---|---|
auto | sets the stack order of the element based on its order in the document. This is default |
number | An integer that defines the stack order of the element. Negative values are allowed |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
Property | Meaning |
---|---|
acceptCharset | The character sets that the server can process; equivalent to the HTML accept-charset attribute. |
action | The URL to send the request to; equivalent to the HTML action attribute. |
elements | An HTMLCollection of all controls in the form. |
enctype | The encoding type of the request; equivalent to the HTML enctype attribute. |
length | The number of controls in the form. |
method | The type of HTTP request to send, typically "get" or "post"; equivalent to the HTML method attribute. |
name | The name of the form; equivalent to the HTML name attribute. |
reset() | Resets all form fields to their default values. |
submit() | Submits the form. |
target | The name of the window to use for sending the request and receiving the response; equivalent to the HTML target attribute. |
Property | Meaning |
---|---|
disabled | A Boolean indicating if the field is disabled. |
form | A pointer to the form that the field belongs to. This property is read-only. |
name | The name of the field. |
readOnly | A Boolean indicating if the field is read-only. |
tabIndex | Indicates the tab order for the field. |
type | The type of the field: "checkbox", "radio", and so on. |
value | The value of the field that will be submitted to the server. For file-input fields, this property is read only and simply contains the file's path on the computer. |
Description | Sample Html | Value Of Type |
---|---|---|
Single-select list | <select>...</select> | "select-one" |
Multi-select list | <select multiple>...</select> | "select-multiple" |
Custom button | <button>...</button> | "submit" |
Custom non submit button | <button type="button">...</button> | "button" |
Custom reset button | <button type="reset">...</button> | "reset" |
Custom submit button | <button type="submit">...</button> | "submit" |
Event | Meaning |
---|---|
blur | Fires when the field loses focus. |
change | Fires when the field loses focus and the value has changed for <input> and <textarea> elements; Fires when the selected option changes for <select> elements. |
focus | Fires when the field gets focus. |
Method | Meaning |
---|---|
add(newOption, relOption) | Adds a new <option> element to the control before the related option. |
multiple | A Boolean value indicating if multiple selections are allowed; equivalent to the HTML multiple attribute. |
options | An HTMLCollection of <option> elements in the control. |
remove(index) | Removes the option in the given position. |
selectedIndex | The zero-based index of the selected option or -1 if no options are selected. For select boxes that allow multiple selections, this is always the first option in the selection. |
size | The number of rows visible in the select box; equivalent to the HTML size attribute. |
Property | Meaning |
---|---|
index | The option's index inside the options collection. |
label | The option's label; equivalent to the HTML label attribute. |
selected | A Boolean value used to indicate if the option is selected. Set this property to true to select an option. |
text | The option's text. |
value | The option's value equivalent to the HTML value attribute. |
Type | Description |
---|---|
Simple values | Strings, numbers, Booleans, and null can all be represented in JSON using the same syntax as JavaScript. The special value undefined is not supported. |
Objects | objects represent ordered key-value pairs. Each value may be a primitive type or a complex type. |
Arrays | arrays represent an ordered list of values that are accessible via a numeric index. The values may be of any type, including simple values, objects, and even other arrays. |
Item | Description |
---|---|
Element: | <canvas> |
Element Type: | Phrasing/Flow |
Permitted Parents: | Any element that can contain phrasing or flow elements |
Local Attributes: | height, width |
Contents: | Phrasing or flow content |
Tag Style: | Start and end tag. |
New in HTML5? | Yes |
Changes in HTML5 | N/A |
Style Convention | None |
Member | Description | Returns |
---|---|---|
height | Corresponds to the height attribute | number |
width | Corresponds to the width attribute | number |
getContext(<context>) | Returns a drawing context for the canvas | object |
Name | Description | Returns |
---|---|---|
clearRect(x, y, w, h) | Clears the specified rectangle | void |
fillRect(x, y, w, h) | Draws a filled rectangle | void |
strokeRect(x, y, w, h) | Draws an unfilled rectangle | void |
Name | Description | Default |
---|---|---|
fillStyle | Gets or sets the style used for filled shapes | black |
lineJoin | Gets or sets the style used when lines meet in a shape | miter |
lineWidth | Gets or sets the width of lines | 1.0 |
strokeStyle | Gets or sets the style used for lines | black |
Name | Description | Returns |
---|---|---|
createLinearGradient(x0, y0, x1, y1) | Creates a linear gradient | CanvasGradient |
createRadialGradient(x0, y0, r0, x1, y1, r1) | Creates a radial gradient | CanvasGradient |
Value | Description |
---|---|
repeat | The image should be repeated vertically and horizontally |
repeat-x | The image should be repeated horizontally |
repeat-y | The image should be repeated vertically |
no-repeat | The image should not be repeated in the pattern |
Value | Description |
---|---|
save() | Saves the values for the drawing state properties and pushes them on the state stack |
restore() | Pops the first set of values from the state stack and uses them to set the drawing state |
Name | Description | Returns |
---|---|---|
beginPath() | Begins a new path | void |
closePath() | Attempts to close the existing path by drawing a line from the end of the last line to the initial coordinates | void |
fill() | Fills the shape described by the sub-paths | void |
isPointInPath(x, y) | Returns true if the specified point is contained by the shape described by the current path | boolean |
lineTo(x, y) | Draws a sub-path to the specified coordinates | void |
moveTo(x, y) | Moves to the specified coordinates without drawing a sub-path | void |
rect(x, y, w, h) | Draws a rectangle whose top-left corners is at (x, y) with width w and height h. | void |
stroke() | Draws the outline of the shape as described by the sub-paths | void |
Name | Description |
---|---|
arc(x, y, rad, start_Angle, end_Angle,direction) | Draws an arc to (x, y) with radius rad, start angle start_Angle, and finish angle end_Angle. The optional direction parameter specifies the direction of the arc |
arcTo(x1, y1, x2, y2,rad) | Draw an arc to (x2, y2) that passes (x1, y1) and has radius radian |
Name | Description |
---|---|
bezierCurveTo(cx1, cy1, cx2, cy2, x, y) | Draws a Bezier curve to the point (x, y) with the control points (cx1, cy1) and (cx2, cy2). |
quadraticCurveTo(cx, xy, x, y) | Draws a quadratic Bezier curve to (x, y) with the control point (cx, cy). |
Name | Description |
---|---|
fillText(<text>, x, y, width) | Draws and fills the specified text at the position (x, y). The optional width argument sets an upper limit on the width of the text |
strokeText(<text>, x, y, width) | Draws and strokes the specified text at the position (x, y). The optional width argument sets an upper limit on the width of the text |
Name | Description | Returns |
---|---|---|
font | Sets the font used when text is drawn | string |
textAlign | Sets the alignment of the text: start, end, left, right, center | string |
textBaseline | Sets the text baseline: top, hanging, middle, alphabetic, ideographic, bottom | string |
Name | Description | Returns |
---|---|---|
shadowBlur | Sets the degree of blur in the shadow | number |
shadowColor | Sets the color of the shadow | string |
shadowOffsetX | Sets the x-offset for the shadow | number |
shadowOffsetY | Sets the y-offset for the shadow | number |