<!DOCTYPE html>
<!-- Created with Ai->Canvas Export Plug-In Version 1.1 (PC/64) -->
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>exemple</title>
<script>
function init() {
var canvas = document.getElementById("canvas" );
var ctx = canvas.getContext("2d" );
draw(ctx);
}
function draw(ctx) {
// calque1/Trac
ctx.save();
ctx.beginPath();
ctx.moveTo(4.0, 208.2);
ctx.bezierCurveTo(4.0, 95.4, 95.4, 4.0, 208.2, 4.0);
ctx.bezierCurveTo(321.0, 4.0, 412.4, 95.4, 412.4, 208.2);
ctx.bezierCurveTo(412.4, 321.0, 321.0, 412.4, 208.2, 412.4);
ctx.bezierCurveTo(95.4, 412.4, 4.0, 321.0, 4.0, 208.2);
ctx.closePath();
ctx.fillStyle = "rgb(0, 0, 155)";
ctx.fill();
ctx.lineWidth = 8.0;
ctx.strokeStyle = "rgb(35, 45, 0)";
ctx.stroke();
// calque1/Bonbon
ctx.font = "48.0px 'MyriadPro'";
ctx.fillStyle = "rgb(101, 0, 0)";
ctx.fillText("Bonbon", 113.7, 212.4);
ctx.restore();
}
function click_circle(event) {
event = event || window.event;
var canvas = document.getElementById('circle'),
x = event.pageX - canvas.offsetLeft,
y = event.pageY - canvas.offsetTop;
// alert(x + ' ' + y);
if (x <= 417 && y <= 417)
self.location="http://forum.hardware.fr";
// On pourrait faire un test plus compliqué
return True;
}
</script>
</head>
<body onload="init()">
<div id="circle" onclick="click_circle()">
<canvas id="canvas" width="417" height="417"></canvas>
</div>
</body>
</html>
|