最近发现一比较实用的网站,于注册了会员,谁知一登陆,发现一个怪事,就是会员登录后网站上的广告就不显示。
感觉这个措施或许在会员体验性有不错的效果,于是研究了起来,终于寻找到织梦dedecms模板会员登陆后不显示广告的方法。
正文
实现织梦dedecms会员登陆后就不显示广告的方法
代码如下:
- function getCookie(Name) {
- var search = Name + "=";
- if (window.document.cookie.length > 0) { // if there are any cookies
- offset = window.document.cookie.indexOf(search);
- if (offset != -1) { // if cookie exists
- offset += search.length; // set index of beginning of value
- end = window.document.cookie.indexOf(";", offset) // set index of end of cookie value
- if (end == -1)
- end = window.document.cookie.length;
- return unescape(window.document.cookie.substring(offset, end));
- }
- }
- return null;
- }
- var username
- username=String(getCookie("DedeUserIDckMd5")).toLowerCase();
- if (username.length<2 || username=="null")
- {
- document.writeln("<a href=\"http:\/\/www.xkzzz.com\" target=\"_blank\">演示:侠客站工站<\/a>")
- }
红色部分为广告代码 。仅供参考学习。
发表评论