Foros del Web » Programando para Internet » ASP Clásico »

Convertir de asp a "jscript"

Estas en el tema de Convertir de asp a "jscript" en el foro de ASP Clásico en Foros del Web. Hola, tengo este codigo en asp que funciona : <HTML> <HEAD> <% set fs = CreateObject("Scripting.FileSystemObject") </HEAD> <BODY> <% function MapURL(path) dim rootPath, url rootPath ...
  #1 (permalink)  
Antiguo 22/02/2008, 02:59
 
Fecha de Ingreso: julio-2006
Mensajes: 145
Antigüedad: 17 años, 11 meses
Puntos: 0
Convertir de asp a "jscript"

Hola, tengo este codigo en asp que funciona :
<HTML>
<HEAD>
<% set fs = CreateObject("Scripting.FileSystemObject")

</HEAD>

<BODY>
<% function MapURL(path)

dim rootPath, url


rootPath = Server.MapPath("/")
url = Right(path, Len(path) - Len(rootPath))
MapURL = Replace(url, "\", "/")

end function %>
<% path = Server.MapPath("/Manuales/")

ListFolderContents(path)



%>
<% sub ListFolderContents(path)

dim fs, folder, file, item, url

set fs = CreateObject("Scripting.FileSystemObject")
set folder = fs.GetFolder(path)



Response.Write("<li><b>" & folder.Name)
Response.Write("</li>")

Response.Write("<ul>" & vbCrLf)

ListFilesContents(path)

for each item in folder.SubFolders
ListFolderContents(item.Path)
next
Response.Write("</ul>" & vbCrLf)

end sub %>

<% sub ListFilesContents(path)

dim fs, folder, file, item, url

set fs = CreateObject("Scripting.FileSystemObject")
set folder = fs.GetFolder(path)

for each item in folder.Files
url = MapURL(item.path)
Response.Write("<li><a href=""" & url & """>" & item.Name & "</a>" & "</li>")
next
end sub %>

</BODY>
</HTML>


y me gustaria pasarlo a jscript.Estoy en ello :
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<% fso = new ActiveXObject("Scripting.FileSystemObject");
%>

</HEAD>

<BODY>
<% function MapURL(path)
{

var rootPath, url,longitud1,longitud2,longitudtotal,elpath;
elpath=path;
rootPath = Server.MapPath("/");
longitud1=elpath.length;
longitud2=rootPath.length;
longitudtotal=longitud1-longitud2;
url = elpath.substring(longitud1,longitudtotal);
MapURL = url.replace("\\", "/");

} %>
<% path = Server.MapPath("/Manuales/")

ListFolderContents(path)

%>
<% function ListFolderContents(path)
{
var fs, folder, file, item, url;

fs = new ActiveXObject("Scripting.FileSystemObject");
folder = fs.GetFolder(path);

Response.Write("<li><b>" & folder.Name);
Response.Write("</li>");

Response.Write("<ul>" + "vbCrLf");


ListFilesContents(path);

for (var f = new Enumerator(folder.SubFolders) ; !f.atEnd(); f.moveNext())

{
ListFolderContents(item.Path);
}
Response.Write("</ul>" + vbCrLf);

}%>

<% function ListFilesContents(path)
{
var fs, folder, file, item, url;

fs = new ActiveXObject("Scripting.FileSystemObject");
folder = fs.GetFolder(path);

for (var f=new Enumerator(folder.files) ; !f.atEnd(); f.moveNext())

{

var temporal=f.item();
url = MapURL(temporal.path);
Response.Write("<li><a href=" + url + ">" + f.item().Name + "</a></li>");
}
}%>

</BODY>
</HTML>


me da errores, si alguien me pudiera ayuddar...Gracias!
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 21:35.