asp.net - 如何实现 "Don' t 再次显示此消息”

标签 asp.net jquery .net-3.5

在 ASP.NET/JQuery/.NET 3.5 环境中,如何显示带有“不再显示此消息”选项的 DIV,单击时不会显示 DIV 给用户。

我需要在两种不同的场景中执行此操作 - 一种是经过身份验证的用户,另一种是匿名用户。

最佳答案

我用了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');
  }

关于asp.net - 如何实现 "Don' t 再次显示此消息”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2465367/

相关文章:

asp.net - 我们需要哪些选项才能从ASP.NET Core Web Api生成PDF

c# - ASPxGridView 每页行数

javascript - AJAX 调用到/从 Node/Express 的 MongoDB 示例?

c# - 什么时候用什么时候不用 Try Catch Finally

c# - 我可以使用反射来获取已被 new 关键字覆盖的基本属性吗?

c# - VBA 中的 VSTO : AddIn. 对象有时返回 Nothing (null)

c# - 为什么这个静态构造函数没有被调用?

c# - Asp.net mvc3、C#、Datetime.Parse()

javascript - Raphael JS 中的动画字体大小是否有流畅的过渡可能性?

javascript - 链接到 JQuery CDN 会降低我的网站速度吗?