php动态生成图像映射的坐标
|
我有一张上面有网格的地图。通过图像地图坐标,网格中的每个单元格都是地图上的可点击区域。我想动态地执行此操作,以节省为图像映射编写所有这些代码的时间,但是我无法完全弄清楚我需要使用的语句或方程式。
这是到目前为止我对图像映射的了解的一个示例。
<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>
如何用更少的代码创建所有这些区域?
没有找到相关结果
已邀请:
3 个回复
癸痊醒
您可以在这里查看其运行情况:http://codepad.org/MMKfY1zc
荒劫娇噬
简单的数学。 :P
漂汀拦