本文介绍了如何在Html2Canvas之外获取变量的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我使用Html2Canvas.js将div转换为画布 var canvasimage = ; html2canvas($( #dvorder),{ onrendered: function (canvas){ theCanvas = canvas; $(' #imgDemo')。append(canvas); $(' #imDemo canvas')。attr(' id', Billcan'); canvasimage = document .getElementById(' Billcan')。toDataURL( image / png); } }); 如何在html2Canvas之外获取变量canvasimage的值 参考: http://jsfiddle.net/8ypxW/3/ [ ^ ] 解决方案 ( #dvorder),{ onrendered: function (canvas){ theCanvas = canvas; (' #imgDemo')。append(canvas); (' #imgDemo canvas')。attr(' id ',' Billcan'); canvasimage = document .getElementById(' Billcan ')。toDataURL( image / png); } }); 如何在html2Canvas之外获取变量canvasimage的值 参考: http://jsfiddle.net/8ypxW/3/ [ ^ ] Iam using Html2Canvas.js for converting a div into canvasvar canvasimage=""; html2canvas($("#dvorder"), { onrendered: function (canvas) { theCanvas = canvas; $('#imgDemo').append(canvas); $('#imgDemo canvas').attr('id', 'Billcan'); canvasimage = document.getElementById('Billcan').toDataURL("image/png"); } });How to get the value of variable canvasimage outside the html2Canvasrefer:http://jsfiddle.net/8ypxW/3/[^] 解决方案 ("#dvorder"), { onrendered: function (canvas) { theCanvas = canvas;('#imgDemo').append(canvas);('#imgDemo canvas').attr('id', 'Billcan'); canvasimage = document.getElementById('Billcan').toDataURL("image/png"); } });How to get the value of variable canvasimage outside the html2Canvasrefer:http://jsfiddle.net/8ypxW/3/[^] 这篇关于如何在Html2Canvas之外获取变量的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-22 09:19