用XML+FSO+JS实现服务器端文件的(2)


var arrhistory=new Array();
var hisi=0;
//用来确定要返回文件名
function check()
{
if (document.all.filename.value=="")
{
alert("请先选择文件");
return false;
}
else
{
window.returnValue =document.f1.folder.value+document.all.filename.value;
window.close();
}
}
//取得XML文件的内容
function getuserlist(url)
{ var oXMLDoc = new ActiveXObject('MSXML');
oXMLDoc.url = url;
var ooRoot=oXMLDoc.root;
return ooRoot;
}
//当选中一个文件时,把这个值返回给文本框
function addfile(txt)
{
document.all.filename.value=txt;
}

var first=1;//定义一个全局变量

function userlist(folders,ti)//列出所选框
{document.f1.folder.value=folders;
filebox.document.body.innerHTML="正在加载文件,请稍侯...";
var strshow="";
var timeoutid=null;
var newfolder="";
var arrfolder=new Array();
var arrff=new Array();
var blankstr="";
var oItem;
//确定历史状态
hisi+=ti;
arrhistory[hisi]=folders;
if (hisi==0)
{
arrow.innerHTML="<img src=\"images/grayarrow.gif\">";
}
else
{
arrow.innerHTML="<img src=\"images/arrow.gif\" border=0 style=\"cursor:hand\" onclick=\"userlist('"+arrhistory[hisi-1]+"',-1)\" onmouseover=\"this.src='images/arrow_over.gif'\" onmouseout=\"this.src='images/arrow.gif'\">";
}
//确定当前的文件夹
if (document.f1.folder.value=="")
{
folderid.innerHTML="<img src=\"images/grayfolder.gif\">"
}
else
{newsfolder=checkfolder(document.f1.folder.value)
folderid.innerHTML="<img src=\"images/folder.gif\" border=0 style=\"cursor:hand\" onclick=\"userlist('"+newsfolder+"',1)\" onmouseover=\"this.src='images/folder_over.gif'\" onmouseout=\"this.src='images/folder.gif'\">"
}
//给下拉框赋值
document.all.select.options.length=0;
newfolder=folders;
folderstr=""
var _obj=document.all.select;
var _o=document.createElement("Option");
_o.text="选择文件夹";
_o.value="";
_obj.add(_o);
if (newfolder!="")
{arrfolder=newfolder.split("/")
for(var i=0;i<arrfolder.length-1;i++)
{blankstr+=" ";
folderstr+=arrfolder[i]+"/";
_o=document.createElement("Option");
_o.text=blankstr+arrfolder[i];
_o.value=folderstr;
_obj.add(_o);

}
}
document.all.select.options[document.all.select.options.length-1].selected=true;
url="getfolder.asp.gl?folder="+folders;
oRoot=getuserlist(url)
strshow="<table class=file cellspacing=0 cellpadding=0>";

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/3703.html