能不能用filesystemobject编写一个服务器上的资源管理器?
发表于:2007-06-30来源:作者:点击数:
标签:
其实可以这样 left frame: use filesystemobject function list all folder on server; use DHTML or treeview display them onclick call display.asp?foldername the code is like this: ================================ %@ LANGUAGE = VB Script % html
其实可以这样
left frame:
use filesystemobject function list all folder on server;
use DHTML or treeview display them
onclick call display.asp?foldername
the code is like this:
================================
<%@ LANGUAGE =
VBScript %>
<html>
<head>
<style TYPE="text/css">
/* Outline Style Sheet */
UL{cursor: hand;
color: navy;
font-family: Arial}
UL UL {display: none;
margin-left: 20pt}
</style>
<link REL="stylesheet" TYPE="text/css" HREF="css/myCSS.CSS">
<script LANGUAGE="
javascript">
<!--
function mousemove()
{
var srcElement;
srcElement=window.event.srcElement;
if ("A" == srcElement.tagName)
{
srcElement.className = "coolstyle";
}
}
function mouseout()
{
var srcElement;
srcElement=window.event.srcElement;
if ("A" == srcElement.tagName)
{
srcElement.className = "normalstyle";
}
}
//-->
</script>
<script LANGUAGE="
JavaScript">
function checkParent(src, dest) {
// Search for a specific parent of the current element
while (src!=null) {
if (src.tagName == dest) return src;
src = src.parentElement;
}
return null;
}
function outline() {
// Expand or collapse if a list item is clicked.
var open = event.srcElement;
// Make sure clicked inside an LI. This test allows rich HTML inside lists.
var el = checkParent(open, "LI");
if (null!=el) {
var pos = 0;
// Search for a nested list
for (var pos=0; pos<el.children.length; pos++) {
if ("UL"==el.children[pos].tagName) break;
}
if (pos==el.children.length) return;
} else return;
el = el.children[pos];
if ("UL"==el.tagName) {
// Expand or Collapse nested list
if (""==el.style.display) {
el.style.display = "block";
el.style.listStyleImage = "url(images/close.gif)";
el.parentElement.style.listStyleImage = "url(images/open.gif)";
}
else
{
el.style.display = "";
el.parentElement.style.listStyleImage = "url(images/close.gif)";
}
}
event.cancelBubble = true;
}
document.onclick = outline;
</script>
<base target="main">
<title>menu</title>
</head>
<body topmargin="0" leftmargin="0">
<SCRIPT LANGUAGE=
vbscript RUNAT = Server>
Dim fs, folderpara, folderArray
Set fs = CreateObject("Scripting.FileSystemObject")
folderArray = Array("root_folder1", "root_folder2")
for i = 0 to 1
folderpara = folderArray(i)
Response.write "<UL>"
Response.write "<LI STYLE=‘’list-style-image: url(images/close.gif)‘’>" & folderpara & "</LI>"
Call ShowFolderList(folderpara)
Response.write "</UL>"
next
set fs = Nothing
Sub ShowFolderList(folderspec)
Dim f, f1, fc, s
Set f = fs.GetFolder(server.mappath(folderspec))
Set fc = f.SubFolders
if (not (fc.count = 0)) then
Response.write "<UL>"
For Each f1 in fc
s = f1.name
If (not ((left (s, 1)) = "_")) then
Response.write "<li onmousemove=‘’mousemove()‘’ onmouseout=‘’mouseout()‘’>"
Response.write "<a href=‘’display.asp?sPath=" & folderspec & "/" & s & "&" & "XDoc=on&
XPpt=on&XZip=on" & "‘’>"
Response.write s & "</LI>"
Response.write "</a>"
Call ShowFolderList((folderspec & "/" & s))
end if
Next
Response.write "</UL>"
end if
end sub
</SCRIPT>
</body>
</html>
=====================================
in the right frame
get the folder parameter
open the folder by using filesystemobject
list all files (you want to list)
call Microsoft document property object (free d/l from web)
list all properties you want
the code is too long to be list here, so...
:-)
原文转自:http://www.ltesting.net