2
I’m making a website and has an image on it that activates a Javascript function through onmouseover
using a function
. One of these methods I used in Javascript adds a new tag to a span
with an "X" id this image is in, only the method instead of creating only once the tag creates the tag every time the mouse hovers over the image.
I need this method to create only once the tag when the mouse passes over the image.
Below the html of the image:
<span id="ex1" >
<img width="794px" height="593px" src="images/crateria.png" style="margin:0;" onmouseover="javascript:mostra();" alt="Crateria" />
</span>
Below the Javascript I used to add the tag, in case the tag <map>
:
function mostra(){
var para = document.createElement("map");
para.setAttribute("name", "crateria-map");
document.getElementById("ex1").appendChild(para);
}
It won’t do you much good to edit the question and include more doubts (even more after you have already marked as solved), you will end up making it too wide. If the first problem has been solved, create a new question to address the second.
– Renan Gomes