当前位置:网站首页>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;
}
});边栏推荐
- My creation anniversary
- Brpc source code analysis (III) -- the mechanism of requesting other servers and writing data to sockets
- 0717RHCSA
- 并发编程 — 内存模型 JMM
- How to understand metrics in keras
- Peripheral system calls SAP's webapi interface
- Pytorch creates its own dataset and loads the dataset
- Install mujoco and report an error: distutils.errors DistutilsExecError: command ‘gcc‘ failed with exit status 1
- Convolutional neural network model -- lenet network structure and code implementation
- C#基础学习(二十三)_窗体与事件
猜你喜欢

安装mujoco报错:distutils.errors.DistutilsExecError: command ‘gcc‘ failed with exit status 1
![[Video] visual interpretation of Markov chain principle and Mrs example of R language region conversion | data sharing](/img/6e/9e0abf8db5ec93080033bd89605ac2.jpg)
[Video] visual interpretation of Markov chain principle and Mrs example of R language region conversion | data sharing

从输入网址到网页显示

MLIR原理与应用技术杂谈

【GCN】《Adaptive Propagation Graph Convolutional Network》(TNNLS 2020)

ESP32-C3 基于Arduino框架下Blinker点灯控制10路开关或继电器组

Design and principle of thread pool

并发编程 — 内存模型 JMM

【AI4Code】《IntelliCode Compose: Code Generation using Transformer》 ESEC/FSE 2020

C # basic learning (XXIII)_ Forms and events
随机推荐
In order to improve efficiency, there are various problems when using parallelstream
Convolutional neural network model -- lenet network structure and code implementation
Handwriting a blog platform ~ first day
【CTR】《Towards Universal Sequence Representation Learning for Recommender Systems》 (KDD‘22)
说说对hashcode和equals方法的理解?
Excel录制宏
并发编程之AQS
0716RHCSA
错误: 找不到或无法加载主类 xxxx
Migrate PaloAlto ha high availability firewall to panorama
R语言GLM广义线性模型:逻辑回归、泊松回归拟合小鼠临床试验数据(剂量和反应)示例和自测题
Atcoder beginer contest 261 f / / tree array
[CSDN year-end summary] end and start, always on the way - "2021 summary of" 1+1= Wang "
The interviewer asked me: how much do you know about MySQL's storage engine?
[Video] visual interpretation of Markov chain principle and Mrs example of R language region conversion | data sharing
Numpy简介和特点(一)
卷积神经网络模型之——GoogLeNet网络结构与代码实现
剑指offer专项突击版第10天
Memory layout of program
Atcoder beginer contest 261e / / bitwise thinking + DP