Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5981517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:57:18+00:00 2026-05-22T21:57:18+00:00

I have a map with a grid on it. each cell of the grid

  • 0

I have a map with a grid on it. each cell of the grid will be a clickable area on the map via image map coords. I would like to do this dynamically to save writing all this code for the image maps, but I can’t quite figure out the statement or equation i need to use.
Here is an example of what I have of the image map so far.

<div style="text-align:center;" id="location_title">The Hearth Lands</div>
                        <img id="map1" src="./images/maps/regions/1.png" usemap="#map1" border="0" width="800" height="800" alt="" />
                        <map name="map1" id="_map1">
                            <area shape="rect" coords="0,0,50,50" href=""  alt="" title="" />
                            <area shape="rect" coords="50,0,100,50" href=""  alt="" title="" />
                            <area shape="rect" coords="100,0,150,50" href=""  alt="" title="" />
                            <area shape="rect" coords="150,0,200,50" href=""  alt="" title="" />
                            <area shape="rect" coords="200,0,250,50" href=""  alt="" title="" />
                            <area shape="rect" coords="250,0,300,50" href=""  alt="" title="" />
                            <area shape="rect" coords="300,0,350,50" href=""  alt="" title="" />
                            <area shape="rect" coords="350,0,400,50" href=""  alt="" title="" />
                            <area shape="rect" coords="400,0,450,50" href=""  alt="" title="" />
                            <area shape="rect" coords="450,0,500,50" href=""  alt="" title="" />
                            <area shape="rect" coords="500,0,550,50" href=""  alt="" title="" />
                            <area shape="rect" coords="550,0,600,50" href=""  alt="" title="" />
                            <area shape="rect" coords="600,0,650,50" href=""  alt="" title="" />
                            <area shape="rect" coords="650,0,700,50" href=""  alt="" title="" />
                            <area shape="rect" coords="700,0,750,50" href=""  alt="" title="" />
                            <area shape="rect" coords="750,0,800,50" href=""  alt="" title="" />

                            <area shape="rect" coords="0,50,50,100" href=""  alt="" title="" />
                            <area shape="rect" coords="50,50,100,100" href=""  alt="" title="" />
                            <area shape="rect" coords="100,50,150,100" href=""  alt="" title="" />
                            <area shape="rect" coords="150,50,200,100" href=""  alt="" title="" />
                            <area shape="rect" coords="200,50,250,100" href=""  alt="" title="" />
                            <area shape="rect" coords="250,50,300,100" href=""  alt="" title="" />
                            <area shape="rect" coords="300,50,350,100" href=""  alt="" title="" />
                            <area shape="rect" coords="350,50,400,100" href=""  alt="" title="" />
                            <area shape="rect" coords="400,50,450,100" href=""  alt="" title="" />
                            <area shape="rect" coords="450,50,500,100" href=""  alt="" title="" />
                            <area shape="rect" coords="500,50,550,100" href=""  alt="" title="" />
                            <area shape="rect" coords="550,50,600,100" href=""  alt="" title="" />
                            <area shape="rect" coords="600,50,650,100" href=""  alt="" title="" />
                            <area shape="rect" coords="650,50,700,100" href=""  alt="" title="" />
                            <area shape="rect" coords="700,50,750,100" href=""  alt="" title="" />
                            <area shape="rect" coords="750,50,800,100" href=""  alt="" title="" />

                            <area shape="rect" coords="0,100,50,150" href=""  alt="" title="" />
                            <area shape="rect" coords="50,100,100,150" href=""  alt="" title="" />
                            <area shape="rect" coords="100,100,150,150" href=""  alt="" title="" />
                            <area shape="rect" coords="150,100,200,150" href=""  alt="" title="" />
                            <area shape="rect" coords="200,100,250,150" href=""  alt="" title="" />
                            <area shape="rect" coords="250,100,300,150" href=""  alt="" title="" />
                            <area shape="rect" coords="300,100,350,150" href=""  alt="" title="" />
                            <area shape="rect" coords="350,100,400,150" href=""  alt="" title="" />
                            <area shape="rect" coords="400,100,450,150" href=""  alt="" title="" />
                            <area shape="rect" coords="450,100,500,150" href=""  alt="" title="" />
                            <area shape="rect" coords="500,100,550,150" href=""  alt="" title="" />
                            <area shape="rect" coords="550,100,600,150" href=""  alt="" title="" />
                            <area shape="rect" coords="600,100,650,150" href=""  alt="" title="" />
                            <area shape="rect" coords="650,100,700,150" href=""  alt="" title="" />
                            <area shape="rect" coords="700,100,750,150" href=""  alt="" title="" />
                            <area shape="rect" coords="750,100,800,150" href=""  alt="" title="" />

                            <area shape="rect" coords="0,150,50,200" href=""  alt="" title="" />
                            <area shape="rect" coords="50,150,100,200" href=""  alt="" title="" />
                            <area shape="rect" coords="100,150,150,200" href=""  alt="" title="" />
                            <area shape="rect" coords="150,150,200,200" href=""  alt="" title="" />
                            <area shape="rect" coords="200,150,250,200" href=""  alt="" title="" />
                            <area shape="rect" coords="250,150,300,200" href=""  alt="" title="" />
                            <area shape="rect" coords="300,150,350,200" href=""  alt="" title="" />
                            <area shape="rect" coords="350,150,400,200" href=""  alt="" title="" />
                            <area shape="rect" coords="400,150,450,200" href=""  alt="" title="" />
                            <area shape="rect" coords="450,150,500,200" href=""  alt="" title="" />
                            <area shape="rect" coords="500,150,550,200" href=""  alt="" title="" />
                            <area shape="rect" coords="550,150,600,200" href=""  alt="" title="" />
                            <area shape="rect" coords="600,150,650,200" href=""  alt="" title="" />
                            <area shape="rect" coords="650,150,700,200" href=""  alt="" title="" />
                            <area shape="rect" coords="700,150,750,200" href=""  alt="" title="" />
                            <area shape="rect" coords="750,150,800,200" href=""  alt="" title="" />

                            <area shape="rect" coords="0,200,50,250" href=""  alt="" title="" />
                            <area shape="rect" coords="50,200,100,250" href=""  alt="" title="" />
                            <area shape="rect" coords="100,200,150,250" href=""  alt="" title="" />
                            <area shape="rect" coords="150,200,200,250" href=""  alt="" title="" />
                            <area shape="rect" coords="200,200,250,250" href=""  alt="" title="" />
                            <area shape="rect" coords="250,200,300,250" href=""  alt="" title="" />
                            <area shape="rect" coords="300,200,350,250" href=""  alt="" title="" />
                            <area shape="rect" coords="350,200,400,250" href=""  alt="" title="" />
                            <area shape="rect" coords="400,200,450,250" href=""  alt="" title="" />
                            <area shape="rect" coords="450,200,500,250" href=""  alt="" title="" />
                            <area shape="rect" coords="500,200,550,250" href=""  alt="" title="" />
                            <area shape="rect" coords="550,200,600,250" href=""  alt="" title="" />
                            <area shape="rect" coords="600,200,650,250" href=""  alt="" title="" />
                            <area shape="rect" coords="650,200,700,250" href=""  alt="" title="" />
                            <area shape="rect" coords="700,200,750,250" href=""  alt="" title="" />
                            <area shape="rect" coords="750,200,800,250" href=""  alt="" title="" />
                        </map>

How can i create all of these areas with less code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T21:57:19+00:00Added an answer on May 22, 2026 at 9:57 pm
    $columns = 5;
    $rows = 5;
    $width = 50;
    $height = 50;
    
    for( $x = 0; $x < $columns; $x++ )
    {
       for( $y = 0; $y < $rows; $y++ )
       {
          $a = ($x * $width);
          $b = ($y * $height);
    
          $coords = array( $a, $b, ($a + $width), ($b + $height) );
          echo '<area shape="rect" coords="'.implode( ',', $coords ).'" href="'.$href.'" alt="'.$alt.'" title="'.$title.'" />';
       }
    }
    

    You can see it in action here: http://codepad.org/MMKfY1zc

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a world map image. I would like to place a SQUARE GRID
I have a map defined like this std::map<some_key_type, std::string::iterator> mIteratorMap; And a huge string
Hopefully this will be clear enough. I have a 2d map made of tiles,
I have a map of a building and I'd like to programmatically highlight specific
I have to map a REST Webservice URL like http://server:8080/application/service/customer/v1 to createCustomer method in
So I have a grid of images (map tiles) and I draw a semi-transparent
I have a SQL database with two tables like this: Users Id (PK) Name
i have a map system (grid) for my website. I have defined 40000 'fields'
Have you ever used jQuery Grid with google maps?, it seems like jQuery grid
I have an IQueryable whose Entity Framework 4 objects I would like to project

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.