JavaScript execution does not take effect when loading rectangles,Change the function to take effect.
Not effective:
javascript:
function createDrawingCanvas(id, width, height) {
var canvas = document.getElementById(id);
var ctx = canvas.getContext('2d');
canvas.width = width || 500;
canvas.height = height || 350;
ctx.lineWidth = 3;
ctx.lineJoin = ctx.lineCap = 'round';
var isDrawing, drawLine;
canvas.onmousedown = function(event) {
isDrawing = true;
drawLine = { x: event.clientX, y: event.clientY };
};
canvas.onmousemove = function(event) {
if (!isDrawing) return;
ctx.beginPath();
ctx.moveTo(drawLine.x, drawLine.y);
ctx.lineTo(event.clientX, event.clientY);
ctx.stroke();
drawLine = { x: event.clientX, y: event.clientY };
};
canvas.onmouseup = function() {
isDrawing = false;
};
};
createDrawingCanvas([[This.name]], [[This.width]], [[This.height ]]);
The following functions take effect:
javascript:
function test() {
alert("Javascript runs");
};
test();