have an array of x,y values which correspond to the map positions.
so when you click on store n
you draw a cross or circle at point x[n],y[n] on the map.
html allows a canvas and the line or arc draw functions to do this
Thanks for your help.
So I need to be able to draw a box at a specified location on the map
This box will have a bunch of text in it. I can use 4 coordinates then?
Would I need 5 arrays, 1 for store name, then the 4 for the coordinates?
Also, I looked up html canvas and didn't see any examples where I could put text in here
or if this will work across frames.
So I need to be able to draw a box at a specified location on the map
This box will have a bunch of text in it. I can use 4 coordinates then?
Would I need 5 arrays, 1 for store name, then the 4 for the coordinates?
Well if the boxes are a fixed size you would only need to store the top x,y corner so just 2 coordinates
@VWP - your code is Ammaaazzzziiinnnngg! You are a coding machine
<!DOCTYPE HTML>
<html>
<body>
<canvas id="myCanvas" width="800" height="600">>Your browser does not support the canvas tag.</canvas>
<script>
var canvas = document.getElementById('myCanvas');
var ctx = canvas.getContext('2d');
var stores = ["Handbags","Hairdressers","Clothes","McDonalds"];
var storex = [50,200,510,300];
var storey = [400,100,50,200];
var i=0;
function displayStore(){
canvas.width=canvas.width;
ctx.beginPath();
ctx.rect(storex[i],storey[i],75,25);
ctx.closePath();
ctx.stroke();
ctx.fillText(stores[i],storex[i]+5,storey[i]+15);
}
function rotateStores(){
displayStore();
i++;
if(i==stores.length){ i=0;}
}
setInterval("rotateStores()",1000);
</script>
</body>
</html>