A (read-only) reference to the canvas element that the CanvasRenderingContext2D object was created for.
Property of apis/canvas/CanvasRenderingContext2Dapis/canvas/CanvasRenderingContext2D
SyntaxNote: This property is read-only.
var result = CanvasRenderingContext2D.html/elements/canvas;
Return Value
Returns an object of type ObjectObject
ExamplesThis example gets the id of the canvas object for which the 2D context was created.
<canvas id="myCanvas" width="300" height="150" style="border:1px solid black;"></canvas>
<p>. . .</p>
<script>
var can = document.getElementById("myCanvas");
var ctxt = can.getContext("2d");
ctxt.fillStyle = "#0000ff";
ctxt.fillRect(10,10,150,75);
alert(ctxt.canvas.id);
</script>
Notes
You can use the canvas property to access the canvas element from functions where you passed in only the current CanvasRenderingContext2D object.
Related specificationsMicrosoft Developer Network: Windows Internet Explorer API reference Article
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4