Looking to create a numbered grid where the user inputs a number and the grid is generated. I am considering using CSS, HTML, or Jquery Mobile for an iPad project. I'm unsure of the best approach at the moment. I would like the grid and numbers to auto generate based on user input.
Currently, I have a div that repeats a grid image across the page, requiring a new image for each background. For example, if a user wants a 40X60 feet area, a 40X60 image must be generated. I would prefer a simpler method where the user can input two numbers for automatic grid and number generation.
<div style="background-image:url(/images/linegrid100.png);
width:980px;height:700px;
border:1px solid black;padding:10px;">
I have explored various grid generators and considered using a table instead of an image. I am unsure about the approach for number generation and have not found much information online even after days of searching. Grids like these are commonly used in graphics and CAD programs.
Any assistance would be greatly appreciated.
Thank you in advance -Rachel
After implementing your code, the result is not as expected. I have been working on it all day and it is starting to make more sense, but I am struggling with the loops and math. Any suggestions? I appreciate the help and find this process enjoyable. Thanks once again -R
The code snippet that seems to be impacting the outcome is:
w = parseInt($square.css('width'), 10) + 2; //the width of each square + 2 pixels for the borders;
If I keep it as is:
If I change the 10 to 100: