真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

如何實現(xiàn)PPJOKE網(wǎng)頁嵌入聊天

這篇文章主要介紹“如何實現(xiàn)PPJOKE網(wǎng)頁嵌入聊天”,在日常操作中,相信很多人在如何實現(xiàn)PPJOKE網(wǎng)頁嵌入聊天問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”如何實現(xiàn)PPJOKE網(wǎng)頁嵌入聊天”的疑惑有所幫助!接下來,請跟著小編一起來學(xué)習(xí)吧!

為海淀等地區(qū)用戶提供了全套網(wǎng)頁設(shè)計制作服務(wù),及海淀網(wǎng)站建設(shè)行業(yè)解決方案。主營業(yè)務(wù)為做網(wǎng)站、網(wǎng)站制作、海淀網(wǎng)站設(shè)計,以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專業(yè)、用心的態(tài)度為用戶提供真誠的服務(wù)。我們深信只要達到每一位用戶的要求,就會得到認(rèn)可,從而選擇與我們長期合作。這樣,我們也可以走得更遠!

PPJOKE是根據(jù)我以前寫的OTALK重寫的。演示地址,向右轉(zhuǎn)--> 已經(jīng)嵌入到了我BLOG中。
http://www.ppjoke.com
PPJOKE整站提供下載。
修改界面顏色
見rar中'ppjoke/ppjoke.css'只要相應(yīng)修改成網(wǎng)站配色就OK

網(wǎng)頁集成說明
將rar中的ppjoke復(fù)制到要嵌入頁面的目錄中,將index.htm中的一下代碼復(fù)制到網(wǎng)頁中向嵌入的div中即可

代碼如下:



document.write("正在加載....

");
var style = document.createElement("link");
style.rel="stylesheet";
style.type="text/css";
style.href='ppjoke/ppjoke.css';
style.title='ppjoke';
var head=document.getElementsByTagName("head")[0];
head.appendChild(style);








var talktime = 3500;//設(shè)置獲取內(nèi)容時間間隔
var talkpath = 'ppjoke/ppjoke.asp';
var talkcolor = 'blue';
var info_shaping ='請勿刷屏';
var info_talkfail ='發(fā)送失敗';
var barinf_logining ='正在登錄';
var barinf_regging = '正在注冊';
var barinf_neterro = '數(shù)據(jù)傳輸錯誤';
var barinf_loginready = '登陸成功';
var barinf_loginerro = '密碼錯誤';
var barinf_blank = '請輸入聊天內(nèi)容';
var barinf_logoutok = '注銷成功';
var barinf_logouterro = '注銷失敗';
var barinf_regerro = '用戶名已存在';
var barinf_regok = '注冊成功,自動登陸';
var barinf_checkuser = '自動登陸中';
var barinf_checkbad = '非法身份,請自行登陸';
var colorArr = ['red','blue','green','darkorange','black','teal','deeppink','blueviolet','springgreen'];
var Anonymous = '匿名';

var count=0;
var lastworld='';
var lastalk='';
var lastWorldTime=false;
var getMsgTime;
var noMemoTimes = 0;
var cookiename;
var cookiepass;

//Event.observe(window, 'load', ppjokeinit, false);

function ppjokeinit(){
    talkcolor = colorArr[Math.round(Math.random()*9)];
    window.setTimeout(getMsg,talktime);
    $('load').style.display='none';
    $('ppjoke_main').style.display='block';
    Event.observe('ppjoke_sendbox', 'keydown', keyDownAll, false);
    Field.select('talk');
    new Draggable('ppjoke_main',{handle:'ppjoke_topbar'});
    createFaceList();
    GetCookie();
    logined();
}

var ppjokeWs = {
    letBack:function(){
        $('ppjoke_main').style.left='';
        $('ppjoke_main').style.top='';
        $('ppjoke_main').style.zIndex='';
        $('ppjoke_main').style.width='150px';
        $('ppjoke_msgbox').style.height='200px';
        $('ppjoke_Facediv').style.height = '100px';
    },
    letBig:function(){
        $('ppjoke_main').style.width = '580px';
        $('ppjoke_msgbox').style.height = '400px';
        $('ppjoke_Facediv').style.height = '25px';
    }
}

function keyDownAll(event){
    var e = event || window.event;
    if(e.keyCode==13){sendMsg()}
}

function logined(){
    function loginok(req){
        if(req.responseText=="ok"){
            $('name').value = cookiename;
            $('alogin').style.display='none';
            $('ppjoke_alogout').style.display='inline';
            $('name').blur();
            $('name').disabled = 'true';
            Field.select('talk');
        }else{
        }
    }        
    if(cookiename){
        var timestamps =  new Date().getTime()+Math.random();
        creatInfo(barinf_checkuser);
        var sendAjax = new Ajax.Request(talkpath+'?act=login×tamp='+timestamps,{method: 'post',parameters:'regname='+cookiename+"®pass="+cookiepass,onComplete:loginok});
    }
}

//獲取信息
function getMsg (){
    var timestamps =  new Date().getTime()+Math.random();
    var getAjax = new Ajax.Request(talkpath+'?act=getMsg×tamps='+timestamps,{method: 'get',parameters:'',onSuccess:showMsg});

    function showMsg(req){

        window.setTimeout(getMsg,talktime);

        var newMsg=eval('(' + req.responseText + ')');

        function appendtime(){
            $('ppjoke_msgbox').appendChild(Builder.node('p', {id:'thelastTime',style:'background-color:#FFCCFF'},'消息發(fā)送時間:'+lastWorldTime));
            appendtimok=true;
        }

        if (noMemoTimes == 5 ){appendtime();noMemoTimes=0}
        noMemoTimes?noMemoTimes++:noMemoTimes=0;

        //處理聊天信息
        newMsg.msg.each(function(data){
            if(noMemoTimes >= 5){Element.remove('thelastTime');}
            noMemoTimes = 1;
                count++;
                var p = document.createElement('p');
                if(count%2==0){
                    Element.addClassName(p,'p1');
                }else{
                    Element.addClassName(p,'p2');
                }
                var userspan = document.createElement('span');
                var usertext = document.createTextNode(data.u+':');
                if(data.v=="True"){
                    userspan.appendChild(usertext);
                }else{
                    userspan.style.color='#CACACA';
                    userspan.appendChild(usertext);
                }
                var msgspan = document.createElement('span');
                msg2face(data.m,msgspan);
                msgspan.style.color=data.c;
                p.appendChild(userspan);
                p.appendChild(msgspan);
                $('ppjoke_msgbox').appendChild(p);
                lastWorldTime=data.t;
            }
        );
        $('ppjoke_msgbox').scrollTop=$('ppjoke_msgbox').scrollHeight;
    }
}

//發(fā)送聊天信息,處理本地消息
function sendMsg (){
    if(!Field.present('talk','name','email')){
        creatInfo(barinf_blank);
        return;
    }

    if(lastworld==Form.serialize('talkform')){
        sysinf(info_shaping);
    }else{

        if($('thelastTime')){Element.remove('thelastTime');}

        var timestamps =  new Date().getTime()+Math.random();
        var sendAjax = new Ajax.Request(talkpath+'?act=sendMsg&color='+talkcolor+'×tamp='+timestamps,{method: 'post',parameters:Form.serialize('talkform'),onFailure:ajaxErro});
        lastworld=Form.serialize('talkform');
        lastalk=$F('talk');

        count++;
        var p = document.createElement('p');
        if(count%2==0){
            Element.addClassName(p,'p1');
        }else{
            Element.addClassName(p,'p2');
        }
        var userspan = document.createElement('span');
        var usertext = document.createTextNode($F('name')+':');
        if($('name').disabled == true){
            userspan.appendChild(usertext);
        }else{
            userspan.style.color='#CACACA';
            userspan.appendChild(usertext);
        }
        var msgspan = document.createElement('span');
        msg2face($F('talk'),msgspan);
        msgspan.style.color=talkcolor;
        p.appendChild(userspan);
        p.appendChild(msgspan);
        $('ppjoke_msgbox').appendChild(p);
    }
    Field.clear('talk');
    Field.select('talk');
    $('ppjoke_msgbox').scrollTop=$('ppjoke_msgbox').scrollHeight;

    function ajaxErro(){
        sysinf(info_talkfail);
    }
}

//發(fā)送登陸信息
function sendLogin (){
    var timestamps =  new Date().getTime()+Math.random();
    creatInfo(barinf_logining);
    var sendAjax = new Ajax.Request(talkpath+'?act=login×tamp='+timestamps,{method: 'post',parameters:Form.serialize('logform'),onComplete:sendLoginOk});
    function sendLoginOk(req){
        if(req.responseText=="ok"){
            creatInfo(barinf_loginready);
            $('alogin').style.display='none';
            $('ppjoke_alogout').style.display='inline';
            $('name').value=$F('regname');
            $('name').blur();
            $('name').disabled = 'true';
            Effect.SlideUp('ppjoke_logdiv',{duration:1.0});
            Field.select('talk');
            CreactCookie();
        }else{
            creatInfo(barinf_loginerro);
        }
    }
}

//發(fā)送注冊信息
function sendReg (){
    var timestamps =  new Date().getTime()+Math.random();
    creatInfo(barinf_regging);
    var sendAjax = new Ajax.Request(talkpath+'?act=reg×tamp='+timestamps,{method: 'post',parameters:Form.serialize('logform'),onComplete:sendRegOk});
    function sendRegOk(req){
        if(req.responseText=="ok"){
            creatInfo(barinf_regok);
            $('alogin').style.display='none';
            $('ppjoke_alogout').style.display='inline';
            $('name').value=$F('regname');
            $('name').blur();
            $('name').disabled = 'true';
            Effect.SlideUp('ppjoke_logdiv',{duration:1.0});
            Field.select('talk');
            CreactCookie();
        }else{
            creatInfo(barinf_regerro);
        }
    }
}

//發(fā)送注銷信息
function sendLogout (){
    var timestamps =  new Date().getTime()+Math.random();
    var sendAjax = new Ajax.Request(talkpath+'?act=logout×tamp='+timestamps,{method: 'get',parameters:'',onComplete:sendLogOutOk});
    function sendLogOutOk(req){
        if(req.responseText=="ok"){
            creatInfo(barinf_logoutok);
            $('ppjoke_logdiv').style.display='none';
            $('alogin').style.display='inline';
            $('ppjoke_alogout').style.display='none';
            $('name').value=Anonymous;
            $('name').blur();
            $('name').disabled = ''
            Field.select('talk');
            clearChat()    ;
        }else{
            creatInfo(barinf_logouterro);
        }
    }
}

function msg2face(msg,element){
    var msgtext=$A(msg.match(/([^\[]*)(\[\d\d\])?/gim));
    if(msgtext[0]){
        msgtext.each(function(word){
            var section = word.match(/([^\[]*)\[?(\d\d)?\]?/i);
            if(section[1]){
            var msgtext = document.createTextNode(section[1]);
            element.appendChild(msgtext);
            }
            if(section[2]){
                msgimg = document.createElement('img');
                msgimg.setAttribute('src','ppjoke/images/smilies/Face_'+section[2]+'.gif');
                element.appendChild(msgimg);
                }
            }
        );
    }else{
        element.appendChild(document.createTextNode(msg));
    }
}

function creatInfo(text){
    $('ppjoke_otherinf').innerHTML=text;
    window.setTimeout(function(){$('ppjoke_otherinf').innerHTML=""},5000);
}

function sysinf(text){
    var p = Builder.node('p',{style:'background-color:yellow'},[Builder.node('span',{style:'color:red'},'系統(tǒng) '),Builder.node('span',{style:'color:blue'},text)]);
    $('ppjoke_msgbox').appendChild(p);
    $('ppjoke_msgbox').scrollTop=$('ppjoke_msgbox').scrollHeight;
}

Ajax.Responders.register(
    {
        onCreate: function(){
            //creatInfo(noMemoTimes);
            $('ajaxing').show();
        },
        onComplete: function() {
            if(Ajax.activeRequestCount == 0){
                $('ajaxing').hide();
            }
        }
    }
);

function createFaceList(){
    for (i=1;i<=24;i++){
        var j=i
        if(j<10){j='0'+i}
        var a = Builder.node('a', {href:'#'},[Builder.node('img',{src:'ppjoke/images/smilies/Face_'+j+'.gif'},[])]);
        a.alt=j;
        a.onclick=function(){$('talk').value=$F('talk')+'['+this.alt+']';Field.focus('talk');return false;};
        var li = Builder.node('li', {},[a]);    
        $('ppjoke_facelist').appendChild(li);
    }
}

function changeColor(color){
    talkcolor=color;
}

function CreactCookie(){
    var mydate = new Date();
    mydate.setTime(mydate.getTime() + 48*60*60*100);
    document.cookie = "ppjokeusername="+escape($F('regname'))+";expires="+mydate.toGMTString();
    document.cookie = "ppjokepass="+escape($F('regpass'))+";expires="+mydate.toGMTString();
}

function GetCookie(){
    var value = unescape(document.cookie);
    var namepos = value.indexOf("ppjokeusername=");
    if(namepos!=-1){
        var start = namepos + 14;
        var end = value.indexOf(";",start);
        if (end == -1) end = value.length;
        cookiename = value.substring(start,end);
    }
    var passpos = value.indexOf("ppjokepass=");
    if(passpos!=-1){
        var start = passpos + 10;
        var end = value.indexOf(";",start);
        if (end == -1) end = value.length;
        cookiepass = value.substring(start,end);
    }
}

function DelCookie(sName,sValue){
  document.cookie = sName + "=" + escape(sValue) + ";expires=Fri, 31 Dec 1999 23:59:59 GMT;";
}

function clearChat(){
    var ps = $A($('ppjoke_msgbox').getElementsByTagName('p'));
    ps.each(function(p){
        Element.remove(p);
        }
    );
}






    XBF


    


    
            
            
    

    

        
            
            
            
            
            
            清屏
            登錄
            注銷
            :)
            
        

        
            
            
        

        
            
                
                
                確定
                注冊
            
        

        
            
                

  •                 

  •                 

  •                 

  •                 

  •                 

  •                 

  •                 

  •                 

  •             
            

            
                
                
            

        




        ppjokeinit();

    到此,關(guān)于“如何實現(xiàn)PPJOKE網(wǎng)頁嵌入聊天”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識,請繼續(xù)關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編會繼續(xù)努力為大家?guī)砀鄬嵱玫奈恼拢?/p>
    本文標(biāo)題:如何實現(xiàn)PPJOKE網(wǎng)頁嵌入聊天
    文章來源:http://weahome.cn/article/igjsii.html

    在線咨詢

    微信咨詢

    電話咨詢

    028-86922220(工作日)

    18980820575(7×24)

    提交需求

    返回頂部