Bạn có thể dùng modal này để thông báo cho người dùng code rất đơn giản
<div class="modal fade" id="memberModal" tabindex="-1" role="dialog" aria-labelledby="memberModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="memberModalLabel">Thông Báo Từ Admin!</h4>
</div>
<div class="modal-body">
{{thongbao|raw}}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">Đóng</button>
</div>
</div>
</div>
</div>
<script>
function Set_Cookie(name, value, expires, path, domain, secure) {
var today = new Date();
today.setTime(today.getTime());
var expires_date = new Date(today.getTime() + (expires));
document.cookie = name + "=" + escape(value) +
((expires) ? ";expires=" + expires_date.toGMTString() : "") +
((path) ? ";path=" + path : "") +
((domain) ? ";domain=" + domain : "") +
((secure) ? ";secure" : "");
}
function Get_Cookie(name) {
var start = document.cookie.indexOf0;
var len = start + name.length + 1;
if ((!start) &&
(name != document.cookie.substring(0, name.length))) {
return null;
}
if -1 return null;
var end = document.cookie.indexOf(";", len);
if -1 end = document.cookie.length;
return unescape(document.cookie.substring(len, end));
}
function Delete_Cookie(name, path, domain) {
if (Get_Cookie(name)) document.cookie = name + "=" +
((path) ? ";path=" + path : "") +
((domain) ? ";domain=" + domain : "") +
";expires=Mon, 11-November-1989 00:00:01 GMT";
}
$(document).ready(function () {
if (Get_Cookie('sinhthanh') == null) {
Set_Cookie'sinhthanh','sinhthanhPopunder','1',';
$('#memberModal').modal('show');
}
});
</script> Copy code #1
Demo : http://hoctap321.xtgem.com
Thêm khảo thêm :
Thay {{thongbao}} thành thông báo của bạn nhé. Ok http://www.w3schools.com/js/js_cookies.asp
Tải ảnh gốc
Demo : http://hoctap321.xtgem.com
Thêm khảo thêm :
Thay {{thongbao}} thành thông báo của bạn nhé. Ok http://www.w3schools.com/js/js_cookies.asp