网站随机弹出QQ对话窗口JS

新一为集团旗下的营销网站加上了一段随机弹QQ窗口,而且对话量还不错啊!现分享给需要的人。希望这一段JS能对他的营销带来便利!

//取得cookie
function getCookie(name) {
 var nameEQ = name + "=";
 var ca = document.cookie.split(';');
 for(var i=0;i < ca.length;i++) {
 var c = ca[i];
 while (c.charAt(0)==' ') {
 c = c.substring(1,c.length);
 }
 if (c.indexOf(nameEQ) == 0) {
 return unescape(c.substring(nameEQ.length,c.length));
 }
 }
 return false;
}

//清除cookie
function clearCookie(name) {
 setCookie(name, "", -1);
}

//设置cookie
function setCookie(name, value, seconds) {
 seconds = seconds || 0;
 var expires = "";
 if (seconds != 0 ) {
 var date = new Date();
 date.setTime(date.getTime()+(seconds*1000));
 expires = "; expires="+date.toGMTString();
 }
 document.cookie = name+"="+escape(value)+expires+"; path=/";
}

var qqin=getCookie('qqin');
var qqinok=getCookie('qqinok');
if(!qqin){
	setCookie('qqin',1,60);
}else if(!qqinok){
	clearCookie('qqin');
	setCookie('qqinok',1,300);
	window.location.href="tencent://message/?uin=416134446&Site=新一&Menu=yes";	
}

转载请注明来源:新一 » 网站随机弹出QQ对话窗口JS

赞 (0) 评论 (0) 分享 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址