l'ho fatto di fretta: prova un poco.
Alla prima richiesto vedo la scritta overlay.
Alla seconda richiesta non vedo più overlay
Modifico la data del sistema mettendo (oggi è il 6/5/2007) 13/5/2007 e rivedo la scritta
codice:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Pagina senza titolo</title>
<script language="javascript" type="text/javascript">
// <!CDATA[
window.onload = window_onload;
function window_onload()
{
var name = "overlay";
var value = getCookie( name );
if(value == null)
{
openoverlay();
setCookie( name, "on", 7 );
}
else
{
closeoverlay();
}
}
function closeoverlay()
{
document.getElementById('overlay').style.display = 'none';
}
function openoverlay()
{
document.getElementById('overlay').style.display = '';
}
//======================================================0
function getCookie( name ) {
var start = document.cookie.indexOf( name + "=" );
var len = start + name.length + 1;
if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
return null;
}
if ( start == -1 ) return null;
var end = document.cookie.indexOf( ";", len );
if ( end == -1 ) end = document.cookie.length;
return unescape( document.cookie.substring( len, end ) );
}
//expires in giorni o frazione di giorni: es. 3 ore = 3/24
//chiamare con escape(value)
function setCookie( name, value, expires, path, domain, secure ) {
var today = new Date();
today.setTime( today.getTime() );
if ( expires ) {
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );
document.cookie = name+"="+( value ) +
( ( expires ) ? ";expires="+expires_date.toGMTString() : "" ) + //expires.toGMTString()
( ( path ) ? ";path=" + path : "" ) +
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}
function deleteCookie( name, path, domain ) {
if ( getCookie( name ) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
//======================================================0
// ]]>
</script>
</head>
<body>
<div id="overlay" style="display:;">overlay</div>
</body>
</html>