我自己的ajax的js文件,我自己看的

 var XMLHttpReq = false;      

    function createXMLHttpRequest() {   
     if(window.XMLHttpRequest) { // 判断是不是Mozilla 
         XMLHttpReq = new XMLHttpRequest();
      }
     else if (window.ActiveXObject) {
try {
XMLHttpReq = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
XMLHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
}
function sendRequest() {
   var url="oaSchedule.do?action=get";
createXMLHttpRequest();
XMLHttpReq.open("GET", url, true);
XMLHttpReq.onreadystatechange = processResponse;
XMLHttpReq.send(null);  
setTimeout("sendRequest()",60000);
}
    function processResponse() {
     if (XMLHttpReq.readyState == 4) { 
         if (XMLHttpReq.status == 200) {
              show();
            } else {
                window.alert("日程信息读取超时");
            }
        }
    }
  function show() {
      var ids = XMLHttpReq.responseXML.getElementsByTagName("id");
   var contents = XMLHttpReq.responseXML.getElementsByTagName("content");
   var remindtimes = XMLHttpReq.responseXML.getElementsByTagName("remindtime");
   var starttimes = XMLHttpReq.responseXML.getElementsByTagName("starttime");
   var url1="";
//    window.alert(ids[0].firstChild.nodeValue);
       if(ids[0].firstChild.nodeValue==0){
       }
       else{
   for(var i = 0; i < contents.length; i++) {
//            window.alert(ids[i].firstChild.nodeValue);
//              window.alert(contents[i].firstChild.nodeValue);
//              window.alert(remindtimes[i].firstChild.nodeValue);
//              window.alert(starttimes[i].firstChild.nodeValue);
               var content = document.getElementById("content");   
//                content.innerHTML="<a title='点击查看详情' href='oaSchedule.do?action=show'><font color='red'>"+ contents[i].firstChild.nodeValue +"</font></a></br></br>"+
//                                   "      <a href='oaSchedule.do?action=update'>"+ "不再提示" +"</a>"
                 url1+="<a title='点击查看详情' href='javascript:open_ScheduleAdd("+ ids[i].firstChild.nodeValue +",2);'><font color='red'>"+ contents[i].firstChild.nodeValue +"</font></a>"+
                                  "      <a href='javascript:update("+ ids[i].firstChild.nodeValue +",0);'>"+ "不再提示" +"</a><br>"
   }  
     content.innerHTML=url1;   
     getMsg();
     }
}
function ShowList() {
   clearList();
   var product = document.getElementById("product");
   var results = XMLHttpReq.responseXML.getElementsByTagName("name");
   var option = null;
   for(var i = 0; i < results.length; i++) {
       option = document.createElement("option");
       option.appendChild(document.createTextNode(results[i].firstChild.nodeValue));
       product.appendChild(option);
   }
}
function clearList() {
   var product = document.getElementById("product");
   while(product.childNodes.length > 0) {
       product.removeChild(product.childNodes[0]);
   }
}
// ri cheng  tishi
window.onresize = resizeDiv;
window.onscroll = resizeDiv;
window.onerror = function(){}
var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,objTimer,i = 0;
function getMsg()
{
  try{
  divTop = parseInt(document.getElementById("eMeng").style.top,10)
  divLeft = parseInt(document.getElementById("eMeng").style.left,10)
  divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10)
  divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10)
  docWidth = document.body.clientWidth;
  docHeight = document.body.clientHeight;
  document.getElementById("eMeng").style.top = parseInt(document.body.scrollTop,10) + docHeight + 10;// divHeight
  document.getElementById("eMeng").style.left = parseInt(document.body.scrollLeft,10)
  document.getElementById("eMeng").style.visibility="visible"
  objTimer = window.setInterval("moveDiv()",10)
  }
  catch(e){}
}
function resizeDiv()
{
//  i+=1
//  if(i>1000) closeDiv()
  try{
  divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10)
  divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10)
  docWidth = document.body.clientWidth;
  docHeight = document.body.clientHeight;
  document.getElementById("eMeng").style.top = docHeight - divHeight + parseInt(document.body.scrollTop,10)
  document.getElementById("eMeng").style.left = parseInt(document.body.scrollLeft,10)
  }
  catch(e){}
}
function moveDiv()
{
  try
  {
  if(parseInt(document.getElementById("eMeng").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10)))
  {
  window.clearInterval(objTimer)
  }
  else{
  divTop = parseInt(document.getElementById("eMeng").style.top,10)
  document.getElementById("eMeng").style.top = divTop - 1  //move up until =
   }
  }
  catch(e){}
}
function closeDiv()
{
  document.getElementById('eMeng').style.visibility='hidden';
  if(objTimer) window.clearInterval(objTimer)
}
function addRow()
        {
        //add one tr
        var newTr = testTbl.insertRow();
        //add two td
        var newTd0 = newTr.insertCell();
        newTd0.className="td6";
        var newTd1 = newTr.insertCell();
        newTd1.className="td6"
        //add td innerHtml
        newTd0.innerHTML = '销售单产品 <input type=text name="product" class="textid"/> 数量 <input type=text name="product" class="textid1"/> 瓶'; 
        newTd1.innerHTML= '&nbsp;';
        }
function addRow1()
        {
        //add one tr
        var newTr = testTbl.insertRow();
        //add two td
        var newTd0 = newTr.insertCell();
        newTd0.className="td6";
        var newTd1 = newTr.insertCell();
        newTd1.className="td6"
        //add td innerHtml
        newTd0.innerHTML = '退货产品 <input type=text name="returned_type" class="textid"/> 数量 <input type=text name="returned_type" class="textid1"/> 瓶'; 
        newTd1.innerHTML= '&nbsp;';
        }
function deleteRow(isTable){
var c = document.getElementsByName('choiceStr');
for(var i=0; i<c.length; i++)
if(c[i].checked)
if(confirm("是否确定删除?")){
isTable.deleteRow(i);
document.ftpEditForm.total.value=document.ftpEditForm.total.value-1;
}
}
function moreSend(){
            XMLHttp.sendReq('GET', 'oaBlog.do?action=get', '', Blog);
XMLHttp.sendReq('GET', 'oaDeclaration.do?action=get', '', Declaration);
      XMLHttp.sendReq('GET', 'rss.do?action=wine', '', Rss);
XMLHttp.sendReq('GET', 'oaMessage.do?action=get', '', Message);
XMLHttp.sendReq('GET', 'oaPetition.do?action=get', '', Petition);
XMLHttp.sendReq('GET', 'oaOrder.do?action=get', '', Order);
XMLHttp.sendReq('GET', 'oaCustomer.do?action=get', '', Customer);
XMLHttp.sendReq('GET', 'oaSchedule.do?action=get1', '', Schedule);
sendRequest();
}   
function update(id,i){
      var url="oaSchedule.do?action=update_remind&id="+id;
      XMLHttp.sendReq('GET', url, '', Schedule_remind);
// sendRequest();
}   
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值