当前位置:网站首页>Canvas判断内容为空
Canvas判断内容为空
2022-07-25 13:23:00 【刺心疯】
//验证canvas画布是否为空函数
function isCanvasBlank(canvas) {
var blank = document.createElement('canvas');//系统获取一个空canvas对象
blank.width = canvas.width;
blank.height = canvas.height;
return canvas.toDataURL() == blank.toDataURL();//比较值相等则为空
}
//调用
/表单非空验证
function checkEmpty() {
var c=document.getElementById("canvas"); // 获取html的canvas对象,我这个id="canvas"
if(isCanvasBlank(c)){
alert("请绘制草图后再上传!");
return;
}
});边栏推荐
- pycharm不能输入中文解决方法
- Shell common script: judge whether the file of the remote host exists
- 6W+字记录实验全过程 | 探索Alluxio经济化数据存储策略
- R语言GLM广义线性模型:逻辑回归、泊松回归拟合小鼠临床试验数据(剂量和反应)示例和自测题
- 备战2022 CSP-J1 2022 CSP-S1 初赛 视频集
- Detailed explanation of the training and prediction process of deep learning [taking lenet model and cifar10 data set as examples]
- mysql函数汇总之日期和时间函数
- 二叉树基本知识
- pytorch创建自己的Dataset加载数据集
- Online Learning and Pricing with Reusable Resources: Linear Bandits with Sub-Exponential Rewards: Li
猜你喜欢

Generate SQL script file by initializing the latest warehousing time of vehicle attributes

VIM basic operation summary

Convolutional neural network model -- lenet network structure and code implementation

Concurrent programming - memory model JMM

【GCN-RS】Learning Explicit User Interest Boundary for Recommendation (WWW‘22)

0710RHCSA

Programmer growth chapter 27: how to evaluate requirements priorities?

0716RHCSA

Redis visualizer RDM installation package sharing

cv2.resize函数报错:error: (-215:Assertion failed) func != 0 in function ‘cv::hal::resize‘
随机推荐
工业互联网的内涵及其应用
领域驱动模型设计与微服务架构落地-模型设计
Error: cannot find or load main class XXXX
Excel import and export source code analysis
int数组获取重复数据
Summary of Niuke forum project deployment
【服务器数据恢复】HP EVA服务器存储RAID信息断电丢失的数据恢复
R language GLM generalized linear model: logistic regression, Poisson regression fitting mouse clinical trial data (dose and response) examples and self-test questions
0719RHCSA
Atcoder beginer contest 261 f / / tree array
全网最简单解决方式1045-Access denied for user [email protected](using password:YES)
好友让我看这段代码
Docekr learning - MySQL 8 master-slave replication setup deployment
[Video] Markov chain Monte Carlo method MCMC principle and R language implementation | data sharing
Excel record macro
Convolutional neural network model -- googlenet network structure and code implementation
[review SSM framework series] 15 - Summary of SSM series blog posts [SSM kill]
【AI4Code】《IntelliCode Compose: Code Generation using Transformer》 ESEC/FSE 2020
[ai4code final chapter] alphacode: competition level code generation with alphacode (deepmind)
Arrays常用方法