请问有没有兼容ios手机的canvas手机签名代码?可以生成用户签名的图片传给后端的。
网友回复
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jquery-3.2.1.min.js"></script> <style> #canvas { background: white; height: 300px; width: 300px; } </style> </head> <body> <canvas id="canvas"> </canvas> <input type="button" class="but1" value="重新签名" /> <input type="button" class="but2" value="提交签名" /> <img id="sigimg" src="" /> <script> var canvas = document.getElementById("canvas"); //动态设置宽高 canvas.width = 400; canvas.height = 300; var content = canvas.getContext("2d"); //设置画笔的样式 content.strokeStyle = "#000"; content.lineWidth = 1; ...
点击查看剩余70%