Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Directory Browsing with JavaScript

Status
Not open for further replies.

Bakunin

Programmer
Dec 21, 2000
31
GB
Hi,
I am trying to build up a simple directory listing sctring to retrieve say, a word document. What I would ideally like to do is view my local directory folders in a browser and navigate to the relevant document in a directory, and from this return a string containing the entire directory mavigation I have just completed.

I currently have some source from //javascript.internet.com to view a directory listing, but when I double click to go to another folder it opens another window. I would prefer to keep all the navigation in one window.

Any help is greatly appreciated.

Thanks
 
Here is the source. unfortunately it uses IFRAME, which is extremely hard to work with, no events etc.

do you have any ideas?

function FolderChoose()
{
var location=document.UserLocation.FolderLocation.value;
document.frames['MyComputer'].location.href = location;
}

<INPUT TYPE=&quot;text&quot; name=&quot;FolderLocation&quot; length=&quot;25&quot; size=&quot;20&quot;>
<INPUT TYPE=&quot;button&quot; value=&quot;Open Folder&quot; onClick=&quot;FolderChoose();&quot; id=button1 name=button1></P>
<P><font size=&quot;2&quot;>EXAMPLE: C:\Program Files\Internet Explorer</font></P>
</FORM>
<IFRAME NAME=&quot;MyComputer&quot; SRC=&quot;about:blank&quot; WIDTH=&quot;50%&quot; HEIGHT=&quot;20%&quot;></IFRAME>
</CENTER>
 
I am a bit confused by the script. A problem I see is in the pathing of the &quot;document.UserLocation.FolderLocation.value&quot; line. Where does UserLocation come from? Is that the name of the form (which is what I am assuming)?

At any rate, when I explicitly declared a value for location using the following:

location=&quot;
It brought google up, so it looks like the construct of

var location=document.UserLocation.FolderLocation.value;

is the problem. Without knowing where UserLocation comes from it is hard to say what the problem is. Looks like you are close to the solution though.
 
Doh... helps if I read your first post again. Yea, it opens up in another window. Interesting dilema. Let me check a couple of things and get back to you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top