I have some issues to convert jQuery code to JavaScript code.
For example, I have this piece of code :
$(document).ready(function() {
doing some stuff
});
I tried to code like this :
document.getElementById("canvas").onload = function () {
doing some stuff
};
but it's not working.
Here is bigger code I'm trying to convert :
$(document).ready(function() {
var color = "#000000";
var sign = false;
var begin_sign = false;
var width_line = 5;
var canvas = $("#canvas");
var cursorX, cursorY;
var context = canvas[0].getContext('2d');
context.lineJoin = 'round';
context.lineCap = 'round';
$(this).mousedown(function(e) {
sign = true;
cursorX = (e.pageX - this.offsetLeft);
cursorY = (e.pageY - this.offsetTop);
});
$(this).mouseup(function() {
sign = false;
begin_sign = false;
});
For information, I want to get this result, in JavaScript: http://p4547.phpnet.org/bikes/canvas.html