我正在编写一个函数来像这样编辑后保存图像
<script type="text/javascript">
function share() {
var canvas = document.getElementById("myCanvas");
var imageObj = new Image();
imageObj.onload = function() {
contentW = $("#content").width();
canvas.width = 400;
canvas.height = 600;
context.drawImage(imageObj, 0, 0,canvas.width,canvas.height);
//the plugin
setTimeout(function(){
window.savephotoplugin(canvas,"image/png",device.version,function(val){
//returns you the saved path in val
alert("Photo Saved: " + val);
});
},0)
}
}
</script>
按钮代码
<div >
<IMG SRC="loadin.png" ALT="some text" WIDTH=100 HEIGHT=100>
<button class="button" id="myCanvas" onclick="share()">SEND </button>
</div>
但是在单击按钮后,phonegap 应用程序中不会触发任何事件。我的代码是正确的,即使 logcat 输出没有错误,但为什么没有得到输出?请帮我