自动弹出对话框的QQ在线客服系统代码

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

网站上自动自动弹出对话框的QQ在线客服系统,有点类似于一些在线客服系统,用户打开网站后,会跳出一个窗口,如下图:

同样,要实现这个功能也很简单,我们可以用Js来实现,现在南昌网站建设公司智网互联就给大家详细的介绍Js代码的写法和如何实现这一功能。

首先是介绍JS文件的写法,先建一个JS文件夹,把下面的代码复制命名为:KF.js

var online= new Array();

var urlroot = "images/";

var tOut = -1;

var drag = false;

var g_safeNode = null;

lastScrollY = 0;

var kfguin;

var ws;

var companyname;

var welcomeword;

var type;

if(kfguin)

{

rightDivHtml = '

';

rightDivHtml += kf_getPopupRightDivHtml(kfguin,ws);

rightDivHtml += '

';

document.write(rightDivHtml);

if(type==1 && kf_getCookie('hasshown')==0)

{

companyname = companyname.substr(0,15);

welcomeword = kf_processWelcomeword(welcomeword);

kfguin = kf_getSafeHTML(kfguin);

companyname = kf_getSafeHTML(companyname);

welcomeword = welcomeword.replace(//g,'\r\n');

welcomeword = kf_getSafeHTML(welcomeword);

welcomeword = welcomeword.replace(/\r/g, "").replace(/\n/g, "
");

window.setTimeout("kf_sleepShow()",2000);

//kf_sleepShow();

}

window.setTimeout("kf_moveWithScroll()",1);

//window.setInterval("wpa_count()",10000);

}

function kf_getSafeHTML(s)

{

var html = "";

var safeNode = g_safeNode;

if(!safeNode)

{

safeNode = document.createElement("TEXTAREA");

}

if(safeNode)

{

safeNode.innerText = s;

html = safeNode.innerHTML;

safeNode.innerText = "";

g_safeNode = safeNode;

}

return html;

}

function kf_moveWithScroll()

{

if(typeof window.pageYOffset != 'undefined') {

nowY = window.pageYOffset;

}

else if(typeof patMode != 'undefined' &&

patMode != 'BackCompat') {

nowY = document.documentElement.scrollTop;

}

else if(typeof document.body != 'undefined') {

nowY = document.body.scrollTop;

}

percent = .1*(nowY - lastScrollY);

if(percent > 0)

{

percent=Math.ceil(percent);

}

else

{

percent=Math.floor(percent);

}

document.getElementById("rightDiv").style.top =

parseInt(document.getElementById("rightDiv").style.top) + percent+"px";

if(document.getElementById("kfpopupDiv"))

{

document.getElementById("kfpopupDiv").style.top =

parseInt(document.getElementById("kfpopupDiv").style.top) + percent+"px"; }

lastScrollY = lastScrollY + percent;

tOut = window.setTimeout("kf_moveWithScroll()",1);

}

function kf_hide()

{

if(tOut!=-1)

{

clearTimeout(tOut);

tOut=-1;

}

document.getElementById("rightDiv").style.visibility = "hidden";

}

function kf_hidekfpopup()

{

if(tOut!=-1)

{

clearTimeout(tOut);

tOut=-1;

}

document.getElementById("kfpopupDiv").style.visibility = "hidden";

相关文档
最新文档