canvas HTML5
le_canvas=getElementById('mon_canvas')
.getContext()
de l'objet canvas.<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
<title>Dessiner un rectangle</title>
</head>
<body>
<canvas id="mon-canvas" width="400" height="400">
<img src="mon_image.png" alt="pas de canvas"/>
</canvas>
<script type="text/javascript">
var le_canvas = document.getElementById('mon-canvas');
var le_contexte = le_canvas.getContext('2d');
//gris semi-transparent
le_contexte.fillStyle = "rgba(128,128,128,0.5)";
le_contexte.strokeStyle = "rgb(255,255,255)"; //blanc
le_contexte.fillRect(10, 5, 350, 350);
le_contexte.strokeRect(10, 5, 350, 350);
</script>
</body>
</html>
image = new Image()
,img.src = 'http://monsite.com/mon_image.jpg'
,<canvas id="cvs" width="800" height="600"/>
<script type="text/javascript">
var ctx =
document.getElementById('cvs).getContext('2d');
var img = new Image();
img.src = 'http://mon-site.com/mon-image.jpg;
ctx.drawImage(img,0,0);
</script>
Il sera judicieux de placer une image se substituant au canvas en cas de non support de cette balise par le navigateur.