in riferimento a questa discussione
puoi provare così
codice:
<html>
<head>
<title></title>
<style type="text/css">
#idlivello {
position: absolute;
width: 300px;
height: 100px;
top: 50%;
left: 50%;
margin-left: -150px;
margin-top: -50px;
background-color:#ff0000;
}
</style>
<script language="javascript" type="text/javascript">
function leggiCk(nome) {
var nameEQ = nome + '=';
var ca = document.cookie.split(';');
for(var i=0;i<ca.length;i++) {
var c=ca[i];
while(c.charAt(0)==' ') c=c.substring(1,c.length);
if(c.indexOf(nameEQ)==0) return c.substring(nameEQ.length,c.length);
}
return null;
}
function scriviCk(nome,valore) {
var date=new Date();
date.setTime(date.getTime()+86400000); // 24*60*60*1000 = 86400000 millisec.
document.cookie=nome+'='+valore+';expires='+date.toGMTString()+'; path=/';
}
function hideit(){
document.getElementById("idlivello").style.visibility="hidden";
}
var volte=leggiCk('popupLyr')
var num=(volte!=null)?parseInt(volte):1;
if(num<=2){
num++
// anteponi un backslash ad ogni apice singolo (qualora presente) nel CONTENUTO DIV
document.write('<div id="idlivello">CONTENUTO DIV</div>');
scriviCk('popupLyr',num)
window.onload=function() {
setTimeout('hideit()',7000);
}
}
</script>
</head>
<body>
...
</body>
</html>