Affiché si chiuda in automatico bisogna lavorarci un po' perchè non funziona su Opera, ma su Explorer dovrebbe andare.
Testato su Firefox e Safari
Codice PHP:
<style type="text/css">
#MyDiv {
width: 600px;
height: 200px;
position: fixed;
top: 50px;
background-color: yellow;
}
#MyDiv .closing{
width: 20px;
height: 20px;
float: right;
background: black;
color: white;
font-size: 20px;
text-align: center;
}
a{
color: white;
text-decoration: none;
}
</style>
<script type="text/javascript">
window.onload = function(){
var newdiv = document.createElementNS("http://www.w3.org/1999/xhtml","html:div");
newdiv.id = 'MyDiv';
var divvi = document.createElementNS("http://www.w3.org/1999/xhtml","html:div");
divvi.className = 'closing';
var a = document.createElementNS("http://www.w3.org/1999/xhtml","html:a");
a.href = 'javascript:void(0)';
a.onclick = close;
divvi.appendChild(a);
a.appendChild(document.createTextNode("X"));
newdiv.appendChild(divvi);
var text = document.createTextNode("QUI CI METTI QUELLO CHE VUOI");
newdiv.appendChild(text);
var w = (window.innerWidth) ? window.innerWidth : document.body.clientWidth;
newdiv.style.left = ((w - 600) / 2) +"px";
document.body.appendChild(newdiv);
setTimeout('close()', 5000);
}
function close()
{
var div = document.getElementById('MyDiv');
if(div)
document.body.removeChild(div);
}
</script>