Beh, un appunto
se il div deve apparire e scomparire piu' volte e' inutile crearlo tutte le volte. e' sufficiente la prima. Quindi fai un controllo per vedere se il div esiste gia'
qualcosa del genere
Codice PHP:
function crea(messaggio) {
obj = document.getElementById("popup");
if(!obj)
{
nuovo_elemento = document.createElement("div");
nuovo_elemento.setAttribute("id","Popup");
nuovo_elemento.setAttribute("class","transparent");
nuovo_elemento.setAttribute("type", "text/css");
nuovo_elemento.innerHTML= "
" + messaggio + "<div>
[url='javascript:Hide()']CHIUDI[/url]</div>";
document.getElementById("container").appendChild(nuovo_elemento);
obj=eval("document.getElementById(\"Popup\")");
obj.style.height="100px";
obj.style.width="500px";
obj.style.border="1px #000000 dotted";
obj.style.margin="0px";
obj.style.filter = "alpha(opacity:80)";
obj.style.backgroundcolor = "#00C100";
obj.style.zIndex = 10000;
}
x = document.body.scrollLeft + windowWidth()/2 - 250;
y = document.body.scrollTop + 300;
obj.style.left = x + "px";
obj.style.top = y + "px";
obj.style.display="block";
}