为 JQuery UI 模态对话框设置 Cookie
当登录我们的网上银行产品以显示消息时,我们有一个 JQuery UI 模态对话框。每次都会弹出这个。现在我们希望使其基于 cookie,以便用户只能看到此框一次,直到其 cookie 被清除。我怎样才能实现这个目标?
<body onLoad="loadPage();" onUnload="unloadPage();">
<script>
$(function() {
// a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!
//$( "#dialog:ui-dialog" ).dialog( "destroy" );
$( "#dialog-modal" ).dialog({
height: 475,
width: 550,
position: 'top',
modal: true,
buttons:{ "Close": function() { $(this).dialog("close"); } },
draggable: false,
resizable: false
});
});
</script>
IMPORTANT MESSAGE FOR ATM/DEBIT CARD HOLDERS
Federal Regulations recently changed, which means we are required to get your permission to consider paying overdrafts on your everyday debit transactions.
Please click here to find out important information regarding overdraft charges and debit card transactions.
We have a JQuery UI Modal Dialog when signing into our internet banking product to display a message. This pops up every single time. Now we want to make this cookie-based so a user only sees this box once until their cookies are cleared. How can I achieve this?
<body onLoad="loadPage();" onUnload="unloadPage();">
<script>
$(function() {
// a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!
//$( "#dialog:ui-dialog" ).dialog( "destroy" );
$( "#dialog-modal" ).dialog({
height: 475,
width: 550,
position: 'top',
modal: true,
buttons:{ "Close": function() { $(this).dialog("close"); } },
draggable: false,
resizable: false
});
});
</script>
IMPORTANT MESSAGE FOR ATM/DEBIT CARD HOLDERS
Federal Regulations recently changed, which means we are required to get your permission to consider paying overdrafts on your everyday debit transactions.
Please click here to find out important information regarding overdraft charges and debit card transactions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最简单的是,您可以使用 jQuery Cookie 插件 创建一个 cookie 来存储他们是否看到它:
Most simply you can create a cookie to store whether they have seen it or not using the jQuery Cookie Plugin:
$.cookie("cookie_name", "cookie_value");
$.cookie("cookie_name", "cookie_value");