Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (120 points)

How to do a clickable grid

Hi, I'm trying to do a grid which look like the famous reddit place /r/rplace
I have a table in my database which contain :
coo_x
coo_y
color
id
It's a 16x16 grid, I already filled up the database with a php script. so I have a database with 256 records in it, and the default color is white on every lines.

I wonder how I can do a grid by taking the coordinates in my database?
I already saw that I can use svg and rect; but I won't create 256 rectangle by hands, I'd like to take records from my database and automatically create a rectangle with the right coordinates.

Also, in order to change the color of it, do I have to make a onclick event on the rectangles? and then change the color?
Welcome To Ask or Share your Answers For Others

Please log in or register to answer this question.

Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...