d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Html5/javascript Clickable Region?
Add Reply New Topic New Poll
Member
Posts: 29,347
Joined: Mar 27 2008
Gold: 504.69
Jan 23 2016 08:42am
I am trying to make a simple battleship game.

I have created a canvas and on it I drew a grid with lines. I am looking for something that equates to "if this region (the area within a cell on the grid) is clicked change some some value".

Is there anything like this, where I can define clickable regions?
Member
Posts: 1,178
Joined: Oct 28 2009
Gold: 1,389.00
Jan 25 2016 07:19pm
Code

function mousedown(event) {
// use event.pageX and event.pageY
}

Use function like this as your mousedown handler.
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll