
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
Getting values from HTML5 Canvas to JavaScript
When we draw anything on Canvas, it keeps no memory of anything that was drawn. While drawing we need to keep track of all the necessary information yourself as we draw. Therefore, it is not feasible to get value from HTML5 canvas to JavaScript as it keeps no memory. It just draws like this −
<canvas id = "myCanvas" height = "300" width = "500" style = "border:2px solid #808080;"></canvas>
On adding a function for button and clicking on it, you won’t be able to get what you want −
<div> <input type = "button" value = "Submit" onclick = "submit()"> </div>
You will not be able to get those values from the canvas since the canvas is just a bitmap.
- Related Articles
- Load image from url and draw to HTML5 Canvas
- Can the HTML5 Canvas element be created from the Canvas constructor?
- HTML5 Canvas to PNG File
- HTML5 Canvas fit to window
- Translating HTML5 canvas
- HTML5 Canvas distorted
- HTML5 Canvas Transformation
- Drawing an image from a data URL to a HTML5 canvas
- How to center canvas in HTML5?
- Zoom HTML5 Canvas to Mouse Cursor
- HTML5 Canvas Transformation Matrix
- HTML5 Canvas Circle Text
- HTML5 Canvas Degree Symbol
- HTML5 Canvas Font Size Based on Canvas Size
- How to detect point on canvas after canvas rotation in HTML5

Advertisements