Ver Mensaje Individual
  #5 (permalink)  
Antiguo 04/03/2003, 04:25
Avatar de KarlanKas
KarlanKas
Moderador extraterrestre
 
Fecha de Ingreso: diciembre-2001
Ubicación: Madrid
Mensajes: 6.987
Antigüedad: 23 años, 1 mes
Puntos: 61
Buscando he encontrado esto:

Es un código para comprobar que existe una unidad, que existe un archivo, que existe un directorio y para crear un archivo. Sólo unciona con IE o con NS y el plugin de ActiveX. Está tomado de aquí Te lo pongo todo porque resulta de lo más interesante:

Código:
<html>
<head>
<title>Javascript split function</title>
<SCRIPT LANGUAGE="JavaScript">
<!--

function driveexists(){
var fso = new ActiveXObject("Scripting.FileSystemObject");
hasDriveBool = fso.DriveExists("c");
alert(hasDriveBool);
}

var archivo="c:\\archivo.txt"

function fileexists(){
var fso = new ActiveXObject("Scripting.FileSystemObject");
fileBool = fso.FileExists(archivo);
if (fileBool){document.location.href="http://www.exist.com"}
else{document.location.href="http://www.noexist.com"}
}

function folderexists(){
var fso = new ActiveXObject("Scripting.FileSystemObject");
folderBool = fso.FolderExists("d:\\old");
}
function opentextfile(){
var ForWriting = 2;
var TriStateFalse = 0;
var fso = new ActiveXObject("Scripting.FileSystemObject");
var newFile = fso.OpenTextFile("f:\\test\\js\\tips\\001122.html", ForWriting, true, TriStateFalse);
}
-->
</SCRIPT>

</head>
<body onload="fileexists()">
</body>
</html>
Si sólo queres lo que pediste sería:
Código:
<html>
<head>
<title>Javascript split function</title>
<SCRIPT LANGUAGE="JavaScript">

var archivo="c:\\ius.dat"
function fileexists(){
var fso = new ActiveXObject("Scripting.FileSystemObject");
fileBool = fso.FileExists(archivo);
if(fileBool){document.location.href="http://www.webareyou.com"}
else{document.location.href="http://www.noexist.com"}
}

</script>

</head>
<body onload="fileexists()">
</body>
</html>

Espero que te sea útil!!
Un saludo!
__________________
Cómo escribir

No hay pregunta tonta, sino tonto que quiere seguir en la ignorancia.

Última edición por KarlanKas; 04/03/2003 a las 04:31