欢迎来到福编程网,本站提供各种互联网专业知识!

filemanage功能中用到的common.js

发布时间:2007-04-08 作者: 来源:转载
functionf_frameStyleResize(targObj){vartargWin=targObj.parent.document.all[targObj.name];if(targWin!=null){varHeightvalue=targObj.document.body.scrollHeightif(Heightvalue
functionf_frameStyleResize(targObj)
{
vartargWin=targObj.parent.document.all[targObj.name];
if(targWin!=null)
{
varHeightvalue=targObj.document.body.scrollHeight
if(Heightvalue<300){Heightvalue=300}//不小于600
targWin.style.pixelHeight=Heightvalue;
}
}
functionf_iframeResize()
{
bLoadComplete=true;
f_frameStyleResize(self);
}


varxmlHttp=false;
try{
xmlHttp=newActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
xmlHttp=newActiveXObject("Microsoft.XMLHTTP");
}catch(e2){
xmlHttp=false;
}
}
if(!xmlHttp&&typeofXMLHttpRequest!='undefined'){
xmlHttp=newXMLHttpRequest();
}


functionshowfiles(){
varurl="showfile.asp?pid"+Math.random();
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=reloadX;
xmlHttp.send(null);
}

functionshowfiles2(folder){
varurl="showfile.asp?foldername="+folder+"&pid"+Math.random();
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=reloadX;
xmlHttp.send(null);
}

functiongoback(){
varurl="showfile.asp?go=back"+"&pid"+Math.random();
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=reloadX;
xmlHttp.send(null);
}

functiongonow(){
document.getElementById("filemanage_all").style.display="block";
varurl="showfile.asp?go=now"+"&pid"+Math.random();
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=reloadX;
xmlHttp.send(null);
}

functionreloadX(){
if(xmlHttp.readyState<4){
setmsg('数据载入,请稍候...');
}
if(xmlHttp.readyState==4){
f_iframeResize();
varresponse=xmlHttp.responseText;
document.getElementById("myfile").innerHTML=response;
varbLoadComplete=false;
f_iframeResize();
}
}

functiondelfile()
{
if(window.confirm("你确定要删除选定文件吗?")==true)
{
varfileid="";
varobj=document.getElementsByName('myselect');
for(vari=0;iif(obj[i].checked)
fileid=fileid+obj[i].value+',';
}
if(fileid)
{
varurl="../delfile.asp?fid="+fileid+"&pid"+Math.random();
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=delfileok;
xmlHttp.send(null);
}
else
{
alert("请先选择文件!");
}
}
}

functionshare()
{
varfileid="";
varobj=document.getElementsByName('myselect');
for(vari=0;iif(obj[i].checked)
fileid=fileid+obj[i].value+',';
}
if(fileid)
{
varurl="../shareit.asp?action=share&myselect="+fileid+"&pid"+Math.random();
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=shareok;
xmlHttp.send(null);
}
else
{
alert("请先选择文件!");
}

}

functiondelfolder(fid)
{
if(window.confirm("你确定要删除选定文件夹吗?")==true)
{
varurl="../delfolder.asp?action=del&fid="+fid;
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=delfolderok;
xmlHttp.send(null);
}
}

functiondellink(lid)
{
if(window.confirm("你确定要删除选定网址标签吗?")==true)
{
varurl="dellink.asp?id="+lid;
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=dellinkok;
xmlHttp.send(null);
}
}

functionformate()
{
if(window.confirm("系统将清除您网盘内的所有数据,您确定要继续吗?")==true)
{
varurl="formate.asp?pid"+Math.random();
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=formateok;
xmlHttp.send(null);
}
}

functionshareok(){
if(xmlHttp.readyState==4){
gonow();
setmsg('文件共享成功!');
}
}

functiondelfolderok(){
if(xmlHttp.readyState==4){
gonow();
setmsg('选定文件夹删除成功!');
}
}

functiondelfileok(){
if(xmlHttp.readyState==4){
gonow();
setmsg('选定文件删除成功!');
}
}

functiondellinkok(){
if(xmlHttp.readyState==4){
gonow();
setmsg('选定网址标签删除成功!');
}
}

functionformateok(){
if(xmlHttp.readyState==4){
showfiles();
setmsg('网盘数据已经全部清空!');
}
}

functionsetmsg(message){
document.getElementById("smessage").style.display="block";
document.getElementById("messagebody").innerHTML=message;
setTimeout(function(){document.getElementById("smessage").style.display="none"},1000);
}


functioneditfolder(fid,inputname,inputvalue,share,npwd,pwd){
document.getElementById(inputvalue).innerHTML="文件夹名:共享需要密码访问密码:";
}

functioneditfolder2(inputname,fid){
varfoldernamex=document.getElementById("temp").value
vary1x='no';
vary2x='no';
varpwdx=document.getElementById("passwordinx").value;
if(document.getElementById("everyonex").checked)
{
y1x=document.getElementById("everyonex").value;
}
if(document.getElementById("needpasswordx").checked)
{
y2x=document.getElementById("needpasswordx").value;
}
if(foldernamex!=undefined)
{
varurl="../editfolder.asp?action=editit&rename="+escape(foldernamex)+"&everyone="+y1x+"&needpassword="+y2x+"&passwordin="+pwdx+"&foldername=/"+inputname+"/&folderid="+fid+"&pid="+Math.random();
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=editfolderok;
xmlHttp.send(null);
}
else
{
setmsg('编辑文件夹取消!');
}
}

functioneditfolderok(){
if(xmlHttp.readyState==4){
gonow();
setmsg('编辑文件夹成功!');
}
}

functioneditfile(fileid,inputname,inputvalue,fileintro,share){

document.getElementById(fileid).innerHTML="文件名:是否公享说明编辑:";
}

functioneditfile2(fileid){
varfilerename=document.getElementById("filerename").value
varfileshare='no';
varfileintro=document.getElementById("fileintro").value;

if(document.getElementById("fileshare").checked)
{
fileshare=document.getElementById("fileshare").value;
}

if(filerename!=undefined)
{
varurl="../editfile.asp?action=save&rename="+escape(filerename)+"&share="+fileshare+"&intro="+fileintro+"&id="+fileid;
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=editfileok;
xmlHttp.send(null);
}
}

functioneditfileok(){
if(xmlHttp.readyState==4){
gonow();
setmsg('编辑文件成功!');
}
}

functionCheckAll(form)
{
for(vari=0;i{
vare=form.elements[i];
e.checked=true
}
}
functionCheckOthers(form)
{
for(vari=0;i{
vare=form.elements[i];
if(e.checked==false)
{
e.checked=true;
}
else
{
e.checked=false;
}
}
}

functioncreatfolder(){
varfoldername=document.getElementById("foldername").value;
vary1='no';
vary2='no';
varpwd=document.getElementById("passwordin").value;

if(document.getElementById("everyone").checked)
{
y1=document.getElementById("everyone").value;
}

if(document.getElementById("needpassword").checked)
{
y2=document.getElementById("needpassword").value;
}

if(foldername!=undefined)
{
varurl="../createfolder.asp?action=create&foldername="+foldername+"&everyone="+y1+"&needpassword="+y2+"&passwordin="+pwd;
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=creatfolderok;
xmlHttp.send(null);
}
}

functioncreatfolderok(){
if(xmlHttp.readyState==4){
hidemenu();
gonow();
setmsg('新建文件夹成功!');
}
}

functionaddlink(){
varurlname=document.getElementById("urlname").value;
vary1='no';
varurllocation=document.getElementById("urllocation").value;
if(document.getElementById("sharethis").checked)
{
y1=document.getElementById("sharethis").value;
}
if(urlname!=undefined)
{
varurl="addlink.asp?uname="+urlname+"&share="+y1+"&uloction="+urllocation;
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=addlinkok;
xmlHttp.send(null);
}
}

functionaddlinkok(){
if(xmlHttp.readyState==4){
hidemenu1();
gonow();
setmsg('网址标签添加成功!');
}
}

functionmovefiles(){
varfileid="";
varobj=document.getElementsByName('myselect');
for(vari=0;iif(obj[i].checked)
fileid=fileid+obj[i].value+',';
}
if(fileid)
{
varfoldername=document.getElementById("folder").value;
varurl="../moveitok.asp?action=createbyurl&folder="+foldername+"&my_select="+fileid;
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=movefilesok;
xmlHttp.send(null);
}
else
{
alert("请先选择文件!");
}
}

functionmovefilesok(){
if(xmlHttp.readyState==4){
hidemenu();
gonow();
setmsg('文件移动成功!');
}
}

varshowl=true;

functionshowmenu2(){
document.getElementById("Movefiles").style.display="block";
document.getElementById('Movefiles').style.height=20;
}
functionshowmenu1(){
document.getElementById("CreateFolder").style.display="block";
document.getElementById('CreateFolder').style.height=20;
}

functionshowmenu4(){
document.getElementById("addlink").style.display="block";
document.getElementById('addlink').style.height=20;
}

functionshowmenu3(){
if(showl!=false)
{
document.getElementById('showloctionx').innerHTML="";
document.getElementById("mylocation").style.display="block";
document.getElementById('mylocation').style.height=20;
showl=false
}
else
{
document.getElementById('showloctionx').innerHTML="";
document.getElementById("mylocation").style.display="none";
showl=true;
}

}

functionhidemenu(){
document.getElementById("Movefiles").style.display="none";
document.getElementById("CreateFolder").style.display="none";
}

functionhidemenu1(){
document.getElementById("addlink").style.display="none";
}

functionsetorderby(){
varorderby=document.getElementById("orderby").value;
varurl="setorderby.asp?setby="+orderby+"&pid="+Math.random();
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=setorderbyok;
xmlHttp.send(null);
}

functionsetorderbyok(){
if(xmlHttp.readyState==4){
gonow();
setmsg('文件排序设置成功!');
}
}


functioneditlink(linkid,urlname,urlloction,share){
document.getElementById(linkid).innerHTML="标签名:是否公享网址编辑:";
}

functioneditlink2(linkidx){
varurlname=document.getElementById("editlinkname").value;
varlinkshare='no';
varurlloction=document.getElementById("editlinkloaction").value;
if(document.getElementById("editlinkshare").checked)
{
linkshare=document.getElementById("editlinkshare").value;
}
if(urlname!=undefined)
{
varurl="editlink.asp?uname="+urlname+"&share="+linkshare+"&uloction="+urlloction+"&id="+linkidx+"&pid="+Math.random();
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=editlinkok;
xmlHttp.send(null);
}
}

functioneditlinkok(){
if(xmlHttp.readyState==4){
gonow();
setmsg('编辑网址标签成功!');
}
}

functionhighlightme(o){
o.parentNode.parentNode.style.backgroundColor=(o.checked)?"#FFEBD7":""
}

相关推荐