28-12-2004, 03:13
|
|
|
חבר מתאריך: 08.11.01
הודעות: 3,109
|
|
אולי זה יעזור...
בדף הראשי:
קוד:
<script>
var tomorrow = new Date(new Date().valueOf() + 60*60*24*1000).toGMTString();
document.cookie = 'SeenHomepage=yes; expires =' + tomorrow;
</script>
<noscript>
<H1> Please Note: to use this website properly, you must enable Javascript </H1>
</noscript>
בשאר הדפים:
קוד:
<script>
// true if cookie exists, false otherwise
function hasCookie(name)
{
var re = new RegExp('(?:^|; )' + name + '=', 'i');
return re.test(document.cookie);
}
if (!hasCookie('SeenHomepage'))
document.location = 'index.html';
</script>
החישוב המתמטי 60*60*24*1000 מעניק לעוגיה חיי מדף של יום אחד. אפשר להוסיף, למשל, *10, כדי להפוך את זה לעשרה ימים, וכד'.
|