濮阳杆衣贸易有限公司

主頁(yè) > 知識(shí)庫(kù) > ajax發(fā)表 讀取 評(píng)論

ajax發(fā)表 讀取 評(píng)論

熱門(mén)標(biāo)簽:上海浦東騰訊地圖標(biāo)注位置 遼寧銀行智能外呼系統(tǒng) 海南銀行智能外呼系統(tǒng)商家 澳大利亞城市地圖標(biāo)注 許昌智能電銷(xiāo)機(jī)器人公司 辰溪地圖標(biāo)注 電銷(xiāo)機(jī)器人違法了嗎 姜堰電銷(xiāo)機(jī)器人 遼寧正規(guī)電銷(xiāo)機(jī)器人
復(fù)制代碼 代碼如下:

-----------------------------Jack的注釋  ajaxJS.js-----------------------------

//這里是顯示一個(gè)等待的窗口
document.write('DIV id="loadingg"  style="HEIGHT:65px; WIDTH: 205px;POSITION: absolute; Z-INDEX:1000;border:3px #fff solid;text-align:center; font-size:12px; font-family:Arial, Helvetica, sans-serif;color:#660000;background:#222;opacity:.7;-moz-opacity:.7;filter: alpha(opacity=70); display:none;">br/>font color="#FF6600">strong>數(shù)據(jù)正在讀取中,請(qǐng)等候.../strong> /font>br/>/DIV>')
//showloading控制等待窗口的顯示和隱藏
function showloading()
{
var obj=document.getElementById("loadingg")
if (obj.style.display!="")
{
obj.style.left=((document.documentElement.clientWidth-parseFloat (obj.style.width))/2)+document.documentElement.scrollLeft+"px";
obj.style.top=((document.documentElement.clientHeight-parseFloat (obj.style.height))/2)+document.documentElement.scrollTop+"px";
obj.style.display="";
}else{obj.style.display="none";}
}

//$()取得指定ID的對(duì)象
function $(id)
{
 return document.getElementById(id); 
}
//echo()向指定的對(duì)象obj顯示指定的html
function echo(obj,html)
{
 $(obj).innerHTML=html;
}
//fopen()使指定的obj處于顯示狀態(tài)
function fopen(obj)
{
 $(obj).style.display="";
}
//fclose()使指定的obj處于隱藏狀態(tài)
function fclose(obj)
{
 $(obj).style.display="none";
}
//createxmlhttp()獲取XMLHttpRequest對(duì)象并返回
function createxmlhttp()
{
 var xmlhttp=false;
 try {
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e) {
    try {
      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
  catch (e) {
      xmlhttp = false;
   }
  }
 if (!xmlhttp  typeof XMLHttpRequest!='undefined') {
    xmlhttp = new XMLHttpRequest();
    if (xmlhttp.overrideMimeType) {//設(shè)置MiME類(lèi)別
   xmlhttp.overrideMimeType('text/xml');
  }
 } 

 return xmlhttp; 
}
//getdata()獲取指定URL的數(shù)據(jù)在obj2里面顯示,obj1是本過(guò)程的提示信息,可刪除
function getdata(url,obj1,obj2)
{
  var xmlhttp=createxmlhttp();
  if(!xmlhttp)
  {
   alert("你的瀏覽器不支持XMLHTTP!!");
   return;
  }
  showloading()
  xmlhttp.onreadystatechange=requestdata;
  xmlhttp.open("GET",url,true);
  xmlhttp.send(null);
  function requestdata()
  {

    fopen(obj1);
    //echo(obj1,"正在加載數(shù)據(jù),請(qǐng)稍等......");
    //alert(xmlhttp.readyState)
    if(xmlhttp.readyState==4)
    {
     if(xmlhttp.status==200)
     {
      if(obj1!=obj2){fclose(obj1);};
      echo(obj2,xmlhttp.responseText);
      showloading()
     }
    }

  }
}
//postdata()發(fā)送指定的數(shù)據(jù)data到url地址,并且使用obj來(lái)顯示返回的數(shù)據(jù)
function postdata(url,obj,data)
{       var rnd=Math.random()
  var xmlhttp=createxmlhttp();
  if(!xmlhttp)
  {
   alert("你的瀏覽器不支持XMLHTTP??!");
   return;
  }
  showloading()
  xmlhttp.open("POST", url, true);
  xmlhttp.onreadystatechange=requestdata;
  xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
  xmlhttp.send(data);
  function requestdata()
  {
   fopen(obj);
   echo(obj,"正在提交數(shù)據(jù),請(qǐng)稍等......");
   if(xmlhttp.readyState==4)
   {
    if(xmlhttp.status==200)
    {
     echo(obj,xmlhttp.responseText);
     reget(rnd);
     setTimeout("echo('showresult','')",2000);
     echo('Message','')
     showloading()
    }
   }
  }
}
//lTrim()去掉字符串左邊的空格
function lTrim(str)
{
  if (str.charAt(0) == " ")
  {
    //如果字串左邊第一個(gè)字符為空格
    str = str.slice(1);//將空格從字串中去掉
    //這一句也可改成 str = str.substring(1, str.length);
    str = lTrim(str);    //遞歸調(diào)用
  }
  return str;
}

//rTrim()去掉字串右邊的空格
function rTrim(str)
{
  var iLength;

  iLength = str.length;
  if (str.charAt(iLength - 1) == " ")
  {
    //如果字串右邊第一個(gè)字符為空格
    str = str.slice(0, iLength - 1);//將空格從字串中去掉
    //這一句也可改成 str = str.substring(0, iLength - 1);
    str = rTrim(str);    //遞歸調(diào)用
  }
  return str;
}

//trim()去掉字串兩邊的空格
function trim(str)
{
  return lTrim(rTrim(str));
}


//f()沒(méi)有通用的意義,只針對(duì)特定對(duì)象
function f(obj)
{
 return trim(eval("document.ajax_post."+obj+".value"));
 //return trim($(obj).value);
}
//SaveReply()是表單的檢查提交函數(shù)
function SaveReply()
{
 if(f("username")=="")
 {
  alert("請(qǐng)?zhí)顚?xiě)用戶(hù)名");
  return false;
 }
 if(f("Message")=="")
 {
  alert("內(nèi)容不可為空");
  return false;
 }
 var validate,password,log_DisKey=0,log_DisURL=0,log_DisSM=0
 validate=""
 password=""
 if(document.ajax_post.log_DisKey.checked){
  log_DisKey=f("log_DisKey")
  }
 if(document.ajax_post.log_DisURL.checked){
  log_DisURL=f("log_DisURL")
  }
 if(document.ajax_post.log_DisSM.checked){
  log_DisSM=f("log_DisSM")
  }
 if((typeof eval(document.ajax_post.validate))!="undefined"){
  if(f("validate")=="")
  {
   alert("請(qǐng)?zhí)顚?xiě)驗(yàn)證碼");
   return false;
  }else{
   validate=f("validate");
  }
 } 
 if((typeof eval(document.ajax_post.password))!="undefined"){
  password=f("password");
 }
 data="username="+escape(f("username"))+"password="+escape(password)+"validate="+escape(validate)+"log_DisSM="+escape(log_DisSM)+"log_DisURL="+escape(log_DisURL)+"log_DisKey="+escape(log_DisKey)+"Message="+escape(f("Message"))+"logID="+escape(f("logID"))+"action="+escape(f("action"));
    //alert(data);
 postdata("wbc_blogcomm.asp","showresult",data);
 return true;
}


調(diào)用:
復(fù)制代碼 代碼如下:

div id=ShowComm>/div>
                script language="javascript" type="text/javascript" src="ajaxJS.js">/script>  
                script language="javascript" type="text/javascript"> 
                  function reget(str){ 
                 getdata('wbc_ShowComm.asp?LogID=100comDesc=DescDisComment=False0.5675318'+str,'ShowComm','ShowComm');
                }
                 reget('get');
                /script>

標(biāo)簽:伊春 威海 深圳 西藏 撫州 崇左 銅川 晉城

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《ajax發(fā)表 讀取 評(píng)論》,本文關(guān)鍵詞  ajax,發(fā)表,讀取,評(píng)論,ajax,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《ajax發(fā)表 讀取 評(píng)論》相關(guān)的同類(lèi)信息!
  • 本頁(yè)收集關(guān)于ajax發(fā)表 讀取 評(píng)論的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    瓮安县| 乳山市| 焉耆| 新安县| 石嘴山市| 彩票| 河源市| 罗源县| 广河县| 竹溪县| 介休市| 理塘县| 伊金霍洛旗| 星座| 海安县| 来凤县| 天峨县| 海城市| 新津县| 元谋县| 丹寨县| 通山县| 仲巴县| 舟曲县| 镇康县| 东宁县| 永嘉县| 克山县| 高雄市| 会泽县| 上蔡县| 鄂托克旗| 新巴尔虎左旗| 高青县| 平安县| 长海县| 博罗县| 读书| 偏关县| 晋城| 凤台县|