Click to See Complete Forum and Search --> : input type=file possible to browse to a directory?
I have an interesting dilemma. I'm trying to use the input type=file to return a path. However, since it was designed to allow users to browse to a file, i'm at a loss. The goal is to allow a user to selct their own path to a directory, then title the directory in an options pop up. Later in a dynamic navigation they can click on a link that THEY'VE CREATED, leading to a whole directory, not a file.
In short, is their anyway of returng a directory path, instead of a path to file?
vwphillips
11-06-2004, 06:28 AM
Not sure I Understand but
<html>
<head>
<title></title>
</head>
<body>
<script language="JavaScript" type="text/javascript">
<!--
vic=0;
document.write('<style> .debug {VISIBILITY: visible; POSITION: absolute; TOP: 500px; z-Index:100; }</style>')
<!---->
</script>
Select a file from directory then save the path<br>
<input type="file" id="dir" value="dir" style="width:0px;" >
<input type="button" value="Save Path" onclick="javascript:SavePath();" >
<script language="JavaScript" type="text/javascript">
<!--
function SavePath(){
if (document.getElementById('dir').value==''){
alert('Select a file from the directory');
return;
}
Path=document.getElementById('dir').value.substring(0,document.getElementById('dir').value.lastIndex Of('\\'));
alert('variable Path='+Path+'\\ ');
}
//-->
</script>
</body>
</html>
remove any spaces between java & script
Yes, that's close. You've taken a builtin html module and rewrote it in javascript (which is good in its own right) however, i need to be able to browse to a folder, not a file.
Thank you for your help!