in"/> in">

Home  >  Article  >  Web Front-end  >  Get value from HTML5 Canvas to JavaScript

Get value from HTML5 Canvas to JavaScript

WBOY
WBOYforward
2023-08-31 18:33:061124browse

从HTML5 Canvas获取值到JavaScript

When we draw anything on the Canvas, it does not retain the memory of anything drawn. When drawing, we need to keep track of all the necessary information ourselves while drawing. Therefore, getting values ​​from HTML5 canvas to JavaScript is not feasible as it does not retain memory. It draws like this -

<canvas id = "myCanvas" height = "300" width = "500" style = "border:2px solid #808080;"></canvas>

After adding functionality to the button and clicking it, you won't be able to get what you want −

<div>
   <input type = "button" value = "Submit" onclick = "submit()">
</div>

You won't be able to get the values ​​from the canvas because The canvas is just a bitmap.

The above is the detailed content of Get value from HTML5 Canvas to JavaScript. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete