[RESOLVED] CSS cursor is not working on dynamically added map tag
Here comes my code:
Code:
function addAlbum(){
var attr;
var parent;
var newelement;
/*image*/
newelement = document.createElement("img");
newelement.src = "criar_album.png";
attr = document.createAttribute("id");
attr.value = "addalbum";
newelement.setAttributeNode(attr);
attr = document.createAttribute("usemap");
attr.value = "#addalbum_map";
newelement.setAttributeNode(attr);
parent = document.getElementById("content");
parent.appendChild(newelement);
/*-----------------------------------------*/
/*map*/
newelement = document.createElement("map");
attr = document.createAttribute("id");
attr.value = "album_map";
newelement.setAttributeNode(attr);
attr = document.createAttribute("style"); /*this part is failing I guess*/
attr.value = "cursor:pointer";
newelement.setAttributeNode(attr);
attr = document.createAttribute("name");
attr.value = "addalbum_map";
newelement.setAttributeNode(attr);
parent = document.getElementById("addalbum");
parent.appendChild(newelement);
/*-----------------------------------------*/
/*area*/
newelement = document.createElement("area");
attr = document.createAttribute("shape");
attr.value = "rect";
newelement.setAttributeNode(attr);
attr = document.createAttribute("coords");
attr.value = "73, 238, 115, 264";
newelement.setAttributeNode(attr);
attr = document.createAttribute("onclick");
attr.value = "createAlbum()";
newelement.setAttributeNode(attr);
attr = document.createAttribute("onmouseover");
attr.value = "highlightOn(470,320,511,346,2)";
newelement.setAttributeNode(attr);
parent = document.getElementById("album_map");
parent.appendChild(newelement);
/*-----------------------------------------*/
}
Everything seems to work fine except part of cursor changing whenever I pass cursor over area element. I have done similar thing with a static image defined in html already and it works, so now I'm confused why it doesn't work with dynamically created map?
P.S.: already defined style for "addalbum" id in CSS but it didn't helped. Btw, I know, there are ways to do it by a tricky way like defining href bur I wanna know what's the real problem here.