<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<%
var oFSO=Server.CreateObject("Scripting.FileSystemObject");
var sRoot="/exp/html/gfx/";
var oFolder=oFSO.GetFolder(Server.MapPath(sRoot));
function kommaTal(b){
tal=String(Math.round(b/1024*100)/100);
tal=((tal.indexOf(".")==-1)?tal+",00":tal);
tal=((tal.indexOf(".")==tal.length-2)?tal+"0":tal);
tal=tal.replace(/\./gi,",");
return (tal);
}
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd"><html>
<head>
<title>Fil der linker til alle html-dokumenter i en mappe</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body, td, a {
font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: 11px;
color: #000066;
}
#files {
width:400px;
border:2px solid black;
margin:15px;
}
-->
</style>
</head>
<body>
<%
Response.Write("Files in Folder: <strong>\""+sRoot+"\"</strong>");
var eFile=new Enumerator(oFolder.Files);
Response.Write('<table cellspacing="0" cellpadding="2" id="files">');
Response.Write('<tr><td><strong><em>Filnavn</em></strong></td><td><strong><em>Strørrelse</em></strong></td><td><strong><em>Filtype</em></strong></td></tr>');
while(!eFile.atEnd()){
var oFile=eFile.item();
Response.Write('<tr><td><a href="'+sRoot+'/'+oFile.Name+'"><strong>'+oFile.Name+'</strong></a></td><td>'+kommaTal(oFile.Size)+'KB</td><td>'+oFile.Type+'</td></tr>');
eFile.moveNext();
}
Response.Write('</table>');
%>
</body>
</html>
roenving >> der kun billeder i den aktuelle mappe ;-) den tager alle filer i en given mappe, som det ønskes: "Min kunde vil gerne have en side der automatisk linker til alle filer i en mappe."
eller skal det kun være html-filer som det står i overskriften?-)