Team:Cornell/javascripts/mycodraw

From 2013.igem.org

(Difference between revisions)
Line 4: Line 4:
var canvas = document.getElementById("mycodraw");
var canvas = document.getElementById("mycodraw");
var img = canvas.children[0];
var img = canvas.children[0];
-
canvas.width = img.width;
+
//canvas.width = img.width;
-
canvas.height = img.height;
+
//canvas.height = img.height;
var context = canvas.getContext("2d");
var context = canvas.getContext("2d");
context.drawImage(img);
context.drawImage(img);
alert(img.src);
alert(img.src);
}
}

Revision as of 17:46, 16 June 2013

function mycoDraw(canvas) { var canvas = document.getElementById("mycodraw"); var img = canvas.children[0]; //canvas.width = img.width; //canvas.height = img.height; var context = canvas.getContext("2d"); context.drawImage(img); alert(img.src); }