<html>
<head>
<script type="application/javascript">
function init() {
var canvas = document.getElementById("canvas");
if (canvas.getContext)
{
var ctx = canvas.getContext("2d");
// Specify the font size and font name
ctx.font = "15px verdana";
//The word "Believe" will begin at (100,20)
ctx.textAlign="start";
ctx.strokeText("Believe start", 100,20);
//The word "Believe" will end at (100,20)
ctx.textAlign="end";
ctx.strokeText("Believe end", 100,40);
//The word "Believe" will begin at (100,20)
ctx.textAlign="left";
ctx.strokeText("Believe left", 100,60);
//The word "Believe" will center at (100,20)
ctx.textAlign="center";
ctx.strokeText("Believe center", 100,80);
//The word "Believe" will begin at (100,20)
ctx.textAlign="right";
ctx.strokeText("Believe right", 100,100);
// Display the text at the specified location. In this case (5,20)
ctx.strokeText("Believe", 5,20);
}
}
</script>
</head>
<body onload="init();">
<canvas id="canvas" width="900"
height="500"></canvas><br>
</body>
</html>
|