Home >php教程 >php手册 >[原创]php+ajax实现模拟Win文件管理系统九

[原创]php+ajax实现模拟Win文件管理系统九

WBOY
WBOYOriginal
2016-06-13 09:58:40974browse

//

本站原创:www.drise.cn

作者:drise1

QQ:271728967

//

接上面的.
 function Senddata(method,url,ReturnValue,Action){  //保存数据

   xmlhttp.open(method,url,true); 

   xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
  
   xmlhttp.setRequestHeader("Cache-Control","no-cache"); //不缓存

   if(ReturnValue !=null){

   xmlhttp.onreadystatechange=ReturnValue;

   }   

   xmlhttp.send(null);
   if(Action == 'mkdir')  //如果是创建文件夹就刷新窗口
   {
    window.location.reload();


   } 

 }


 function ReturnValue(){//返回值

  if(xmlhttp.readystate != 4 || xmlhttp.status != 200){
   document.getElementById("t0").innerHTML="

正在发送...
";
 }

  if( xmlhttp.readystate == 4 || xmlhttp.status == 200 ){

   document.getElementById("t0").innerHTML="

"+xmlhttp.responseText+"
";
 } 

 setInterval("func()",3000);//设置3000秒延迟
 }

 function func(){
  ob=document.getElementById('info');

    ob.style.display = 'none';

 }

下面为删除

 function del(obj){  


  if(confirm("确实要删除\""+obj+"\"吗?","","")){   


   CreateAjax();   


   var Delurl="rename.php?path="+encodeURI(obj.replace("/","\/"))+"&action=del&rd="+Math.random();


    xmlhttp.open("GET",Delurl,true);   


    xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");   


    xmlhttp.setRequestHeader("Cache-Control","no-cache");


    xmlhttp.onreadystatechange=function(){


     if (xmlhttp.readystate == 4 || xmlhttp.status == 200){ 


      var value=xmlhttp.responseText;


     if( value =='t' ){


      document.getElementById(obj).style.display="none";


     }else if( value =='fo'){


      alert("操作失败,请查看权限或文件夹不为空!foss!");


     }else if( value =="ff"){


      alert("操作失败,请查看权限!");


     }else{


      alert("操作失败,请查看权限或文件夹不为空!!");


     } 


     


    }


    }


    xmlhttp.send(null);


   }


 } 


  

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn