appenchild area sur balise map
Bonjour,
j'ai un soucis concernant l'ajout de balises <area> dans une <map>
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| <html>
<section id="focal">
<div class="parent" id="parent">
<div class="panzoom">
<img src="../../img/carte.png" width="1290" height="1050" usemap='#ma_map' id="carte">
<map name='ma_map' id='ma_map' title="cliquez pour zoomer">
<?php // echo $area; ?>
</map>
</div>
</div>
</section>
</html> |
et le js
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| var map = eval('(' + req.responseText + ')')
, fragment = document.createDocumentFragment()
, i = 0
, a
, nbX = map.length
, nbY = map[i].length
, b = document.getElementById("ma_map");
alert(b.name);
for(; i < nbX; i++)
{
for(j = 0; j < nbY; j++)
{
tab = map[i][j].split('/');
a = document.createElement("AREA");
a.href = '../../IHM/Cases/Terrain.php&id='+tab[0];
a.shape = 'rect';
a.coords = i, j, i+135, j+135;
a.title=tab[1]+' => ('+i+', '+j+')\n'+tab[2];
a.alt = tab[1];
fragment.appendChild(a);
}
}
alert('on ajoute'+fragment.childNodes[9999].title); b.appendChild(fragment); alert('fin area'); |
un grand merci d'avance