如何实现"不再显示此消息"

Dot*_*ude 2 asp.net jquery .net-3.5

在ASP.NET /JQuery/.NET 3.5环境中,如何DIV在单击时显示"不再显示此消息"选项将不会DIV向用户显示该选项.

我需要在两种不同的场景中做到这一点 - 一个是经过身份验证的用户,另一个是匿名用户.

mcg*_*ilm 5

我使用jquery cookie插件来设置cookie并在显示对话框之前读取它

示例:具有一点奖励功能

  if ($.cookie("warned") != "warned"){
    display_alert("WARNING: This diallog will not appear again until your next session");
    $.cookie('warned', 'warned', { expires: 0 }); 
  }

  function display_alert(message,title) {
    title = title || "Alert";
      $('#alert').text(message);

      $("#alert").dialog({
          autoOpen: false,
          bgiframe: true,
          modal: true,
        title:title,
          buttons: {
              OK: function() {
                  $(this).dialog('close');
              }
          }
      });
    $('#alert').dialog('option', 'title', title);
      $("#alert").dialog('open');
  }
Run Code Online (Sandbox Code Playgroud)