admin管理员组

文章数量:1395329

I want create a div container with a message for first time visitors to my site. Visitors will read it and click a 'Hide' button to dissapear it forever.

How is this done?

I want create a div container with a message for first time visitors to my site. Visitors will read it and click a 'Hide' button to dissapear it forever.

How is this done?

Share Improve this question edited Apr 16, 2009 at 14:58 moff 6,51333 silver badges30 bronze badges asked Apr 16, 2009 at 14:42 ZanderZander 2,6844 gold badges33 silver badges56 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 8

What about using the Cookie plugin for jQuery?

$.cookie('the_cookie', 'the_value'); // Create a session cookie ("the_cookie") and set its value to "the_value"
$.cookie('chocolate_chip_cookie', 'the_value', { // create a cookie with all available options
    expires: 7, // expires in seven days
    path: '/', // accessible from the whole site...
    domain: 'jquery.',
    secure: true // ...but only on a secure connection
});
$.cookie('the_cookie', null); // delete the session cookie

You can acplish this by:

  1. Setting a cookie.
  2. Storing the status in a session.

You can do 1. with JavaScript but also with PHP. 2. can only be acplished server-side with e.g. PHP.

This tutorial may be helpful: http://www.shopdev.co.uk/blog/cookies-with-jquery-designing-collapsible-layouts/

本文标签: