欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Ajax Blog 用到的幾個(gè)函數(shù)第1/3頁(yè)

 更新時(shí)間:2006年10月03日 00:00:00   作者:  
類(lèi)名:AJAX 
復(fù)制代碼 代碼如下:

/*類(lèi)名:AJAX

創(chuàng)建方法:var ajaxobj=new AJAX;,如果創(chuàng)建失敗則返回false

屬性:method  -  請(qǐng)求方法,字符串,POST或者GET,默認(rèn)為POST
   url       - 請(qǐng)求URL,字符串,默認(rèn)為空
   async     - 是否異步,true為異步,false為同步,默認(rèn)為true
   content   - 請(qǐng)求的內(nèi)容,如果請(qǐng)求方法為POST需要設(shè)定此屬性,默認(rèn)為空
      backtext  - 默認(rèn)true當(dāng)backtext=true時(shí)返回XMLHttp.responseText為false時(shí)返回XMLHttp.responseXML 
      gettext  - 返回值
   callback  - 回調(diào)函數(shù),即返回響應(yīng)內(nèi)容時(shí)調(diào)用的函數(shù),默認(rèn)為直接返回,回調(diào)函數(shù)有一個(gè)參數(shù)為XMLHttpRequest對(duì)象,即定義回調(diào)函數(shù)時(shí)要這樣:function mycallback(xmlobj)

方法:send()     -  發(fā)送請(qǐng)求,無(wú)參數(shù)

*/

function AJAX() {
    var XMLHttp = false;
    var ObjSelf;
    ObjSelf=this;
    try { XMLHttp=new XMLHttpRequest; }
    catch(e) {
        try { XMLHttp=new ActiveXObject("MSXML2.XMLHttp"); }
        catch(e2) {
            try { XMLHttp=new ActiveXObject("Microsoft.XMLHttp"); }
            catch(e3) { XMLHttp=false; }
        }
    }
    if (!XMLHttp) return false;
    this.method="POST";
    this.url=""
    this.url += (this.url.indexOf("?") >= 0) ? "&nowtime=" + new Date().getTime():"?nowtime=" + new Date().getTime();
    this.async=true;
    this.data="";
    ObjSelf.loadid=""
    this.backtext=true
    this.callback=function() {return;}

    this.send=function() {
        if(!this.method||!this.url||!this.async) return false;
        XMLHttp.open (this.method, this.url, this.async);
        if(this.method=="POST"){
            XMLHttp.setRequestHeader("Content-Length",(this.data).length); 
            XMLHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
        }

        XMLHttp.onreadystatechange=function() {
            if(XMLHttp.readyState==4) {
                //alert(ObjSelf.loadid);
                if (ObjSelf.loadid!="") $CS(ObjSelf.loadid,"none");
                //window.status="";
                if(XMLHttp.status==200) {
                    ObjSelf.callback();
                }
            }
            else {
                if (ObjSelf.loadid!="") $CS(ObjSelf.loadid,"block");
                //window.status="狀態(tài):["+XMLHttp.readyState+"]正在加載......";
            }
        }

        if(this.method=="POST") XMLHttp.send(this.data);
        else XMLHttp.send(null);
    }

    this.gettext=function(){
        if(XMLHttp.readyState==4) {
            if(XMLHttp.status==200) {
                if (this.backtext==true){
                    return XMLHttp.responseText;
                }else{
                    return XMLHttp.responseXML;
                }     
            }
            }
    }
}



blog.js
復(fù)制代碼 代碼如下:

//打開(kāi)和關(guān)閉左欄
function $SHleft(id){
     if($(id).style.display=='none'){
        $(id).style.display='block';
        $("content").style.width='550px';
        $F("sh","隱藏左欄");
    }
    else{
        $(id).style.display='none';
        $("content").style.width='750px';
        $F("sh","打開(kāi)左欄");
    }
}
//打開(kāi)和關(guān)閉評(píng)論
function $PL(id,plid){  
  if($("rp"+id).style.display=='none'){
     $("rp"+id).style.display='block';
     $F("pl"+id,"隱藏評(píng)論");
     replycon(id,"rp"+id);
    }
    else{
      $("rp"+id).style.display='none';
      $F("pl"+id,"查看評(píng)論");
    }
}

//顯示日志
function show(id,pageid,rq){
    var ajaxobj=new AJAX();   
    ajaxobj.method="GET"; 
    ajaxobj.loadid="loadnews";
    ajaxobj.url="lib.asp?action=show&sid="+id+"&rq="+escape(rq)+"&page="+pageid;
    ajaxobj.callback=function(){
    $F("bkcon",ajaxobj.gettext());
    }
    ajaxobj.send(); 
}
//顯示日志分類(lèi)列表
function board(){
    var ajaxobj=new AJAX();   
    ajaxobj.method="GET"; 
    ajaxobj.loadid="loadnews";
    ajaxobj.url="lib.asp?action=board";
    ajaxobj.callback=function(){
    $F("blogcon",ajaxobj.gettext());
    }
    ajaxobj.send(); 
}

//取得評(píng)論內(nèi)容
function replycon(rid,rpid){
    var ajaxobj=new AJAX();   
    ajaxobj.method="GET"; 
    ajaxobj.loadid="loadnews";
    ajaxobj.url="lib.asp?action=replycon&rid="+rid;
    ajaxobj.callback=function(){
    $F(rpid,ajaxobj.gettext());
    }
    ajaxobj.send(); 
}

//取得評(píng)論數(shù)量
function plnum(rid){
    var ajaxobj=new AJAX();   
    ajaxobj.method="GET"; 
    ajaxobj.loadid="loadnews";
    ajaxobj.url="lib.asp?action=plnum&rid="+rid;
    ajaxobj.callback=function(){
    $F("plnum"+rid,ajaxobj.gettext());
    }
    ajaxobj.send(); 
}

//加載發(fā)表評(píng)論表單
function rform(rid){
    var ajaxobj=new AJAX();   
    ajaxobj.method="GET"; 
    ajaxobj.loadid="loadnews";
    ajaxobj.url="lib.asp?action=rform&rid="+rid;
    ajaxobj.callback=function(){
    $F("plform"+rid,ajaxobj.gettext());
    }
    ajaxobj.send(); 
}

//添加評(píng)論內(nèi)容
function savepl(rid){
    var ajaxobj=new AJAX();   
    ajaxobj.method="POST"; 
    ajaxobj.loadid="loadnews";
    ajaxobj.url="lib.asp?action=savepl&";
    ajaxobj.data="rid="+rid+"&username="+escape($("username"+rid).value)+"&con="+escape($("con"+rid).value);
    ajaxobj.callback=function(){
    $F("tjpl"+rid,ajaxobj.gettext());
    if (ajaxobj.gettext().indexOf("評(píng)論已提交成功")>=0) {
       //如果評(píng)論提交成功則關(guān)閉表單、重新取得評(píng)論的數(shù)量。關(guān)閉成功提示信息
        $CS("rform"+rid,"none");
        plnum(rid);
        pltjid="pltjsuc"+rid;
        setTimeout('$CS(pltjid,"none")',1000);
    }
    }
    ajaxobj.send(); 
}
//顯示日歷
function rl(ReqDate){
    var ajaxobj=new AJAX();   
    ajaxobj.method="GET"; 
    ajaxobj.loadid="loadnews";
    ajaxobj.url="lib.asp?action=rl&ReqDate="+ReqDate;
    ajaxobj.callback=function(){
    $F("calendarcon",ajaxobj.gettext());
    }
    ajaxobj.send(); 
}
//顯示留言表單
function gb(){
    var ajaxobj=new AJAX();   
    ajaxobj.method="GET"; 
    ajaxobj.loadid="loadnews";
    ajaxobj.url="lib.asp?action=gb";
    ajaxobj.callback=function(){
    $F("gbform",ajaxobj.gettext());
    }
    ajaxobj.send(); 
}

//提交留言
function savegb(){
    var gbusername=$("gbusername").value;
    var gbemail=$("gbemail").value;
    var gbcon=$("gbcon").value;
    //alert($("gbusername").value);
    //alert($("gbemail").value);
    //alert($("gbcon").value);
    //return false;
    if (gbusername==""){
        $CS("gberr","block");
        $F("gberr","請(qǐng)署上你的大名");
        setTimeout('$CS("gberr","none")',2000);
        return false;
    }
    if (gbemail==""){
        $CS("gberr","block");
        $F("gberr","請(qǐng)寫(xiě)上你的郵箱");
        setTimeout('$CS("gberr","none")',2000);
        return false;
    }
    if (gbcon==""){
        $CS("gberr","block");
        $F("gberr","請(qǐng)發(fā)表你的意見(jiàn)");
        setTimeout('$CS("gberr","none")',2000);
        return false;
    }
    var ajaxobj=new AJAX();   
    ajaxobj.method="POST"; 
    ajaxobj.loadid="loadnews";
    ajaxobj.url="lib.asp?action=addgb&";
    ajaxobj.data="username="+escape(gbusername)+"&email="+escape(gbemail)+"&con="+escape(gbcon);
    ajaxobj.send(); 
    ajaxobj.callback=function(){
        if (ajaxobj.gettext().indexOf("成功")>=0) {
        $SHwin("gb");
        showgb(1);
        }
    }    
}
//顯示留言
function showgb(pageid){
    var ajaxobj=new AJAX();   
    ajaxobj.method="GET"; 
    ajaxobj.loadid="loadnews";
    ajaxobj.url="lib.asp?action=showgb&page="+pageid;
    ajaxobj.callback=function(){
    $F("bkcon",ajaxobj.gettext());
    }
    ajaxobj.send(); 
}

相關(guān)文章

最新評(píng)論