我已经尝试了这么多的代码。我有两个圆圈旁边有一个链接,我需要在相应链接的点击上为圆圈着色。提出一些解决方案
<body>
<div class="row-fluid">
<div class="span1 offset3">
<canvas id="myCanvas" width="100" height="100"></canvas>
</div>
<div class="span1">
<br/><a href="#" onclick="function();">Hello</a>
</div>
<div class="span1">
<canvas id="myCanvas1" width="100" height="100"></canvas>
</div>
<div class="span1">
<br/><a href="#" onclick="function();">Hi</a>
</div>
</div>
<script>
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.beginPath();
ctx.arc(55, 30, 20, 0, 2 * Math.PI);
ctx.stroke();
var c = document.getElementById("myCanvas1");
var ctx = c.getContext("2d");
ctx.beginPath();
ctx.arc(55, 30, 20, 0, 2 * Math.PI);
ctx.stroke();
function () {
//onclick function which will change the color of the correspondind circle
}
</script>
</body>