今天接了一个小事,一个朋友想实现货物在线签收,要收货人在线签名,并保存入库,让我帮忙写一个asp的手写签名功能,忙活一下午实现了,估计会有很多人有这种需求,放网上吧
function lineCanvas(obj) {
this.linewidth = 1;
this.color = "#000000";
this.background = "#ffffff";
for (var i in obj) {
this[i] = obj[i];
};
this.canvas = document.createElement("canvas");
this.el.appendChild(this.canvas);
this.cxt = this.canvas.getContext("2d");
this.canvas.width = this.el.clientWidth;
this.canvas.height = this.el.clientHeight;
this.cxt.fillStyle = this.background;
this.cxt.fillRect(0, 0, this.canvas.width, this.canvas.width);
this.cxt.strokeStyle = this.color;
this.cxt.lineWidth = this.linewidth;
this.cxt.lineCap = "round";
//开始绘制
&

本文分享了一段使用ASP实现的手写签名功能的代码,适用于在线签收场景。通过JavaScript操作canvas元素,实现了触屏设备上的签名绘制、清除和保存为base64格式,并提供了数据发送到服务器的示例。
最低0.47元/天 解锁文章
878

被折叠的 条评论
为什么被折叠?



