<!DOCTYPE html>
<html>
<body>
Найти цифру 9 среди массива 6.
<br>
<div id="out">
</div>
<br>
<canvas id="myCanvas" width="700" height="600"
style="border:1px solid #d3d3d3;">
</canvas>
<script>
var canvas = document.getElementById("myCanvas");
var ctx = canvas.getContext("2d");
ctx.font = "30px Arial";
var ind1 = Math.floor(Math.random() * 19)+1;
var ind2 = Math.floor(Math.random() * 9)+1;
var out = document.getElementById("out");
out.innerHTML = ind1 +" " + ind2;
for (var index1 = 0; index1 < 20;index1++){
for (var index2 = 0; index2 < 10;index2++){
if (ind1 == index1 && ind2 == index2){
ctx.fillStyle = "red";
ctx.fillText("9",index1*25,index2*35);
}
else{
ctx.fillStyle = "black";
ctx.fillText("6",index1*25,index2*35);
}
}
}
</script>
</body>
</html>
|