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

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

代码如下:

//取得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=190707072&Site=中山古镇网站建设&Menu=yes";
}