473,796 Members | 2,558 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

can javascript read a folder or/and xml file

epots9
1,351 Recognized Expert Top Contributor
what i am trying to do is i want my javascript to read the contents of a folder, this folder will only contain files (pictures). Once the it reads in all the file names that are there i would store them into an array and randomly display them (by changing the src of one of my image tags).

If that can not be done i was thinking about try creating an xml file that can hold all the file names, but i'm not too sure how to read xml with javascript.

also, i am trying to do this without any server-side scripting....cu z my host doesn't allow that (its free).

I don't have any code to show cuz i;m not sure how to start this, and i am not asking for the complete code. If either or both methods are possible any helpful tutorials would be a great help.

Thank you in advance for all your suggestions.
Jul 21 '07 #1
4 4258
pbmods
5,821 Recognized Expert Expert
Heya, epots9.

Unfortunately (or fortunately, depending on how you look at it), JavaScript cannot browse the local nor the server filesystem.

Without being able to do any server-side scripting, an XML file is probably a good second option.

But probably the easier solution is to save a JSON-encoded object in a file and then fetch and eval() that using JavaScript instead.
Jul 21 '07 #2
epots9
1,351 Recognized Expert Top Contributor
Heya, epots9.

Unfortunately (or fortunately, depending on how you look at it), JavaScript cannot browse the local nor the server filesystem.

Without being able to do any server-side scripting, an XML file is probably a good second option.

But probably the easier solution is to save a JSON-encoded object in a file and then fetch and eval() that using JavaScript instead.
darn...oh well i'll use an xml file....i playing around with some code now.

thanks for your help
Jul 21 '07 #3
pbmods
5,821 Recognized Expert Expert
Good luck!

You may find this article to be of some help.
Jul 21 '07 #4
epots9
1,351 Recognized Expert Top Contributor
Good luck!

You may find this article to be of some help.
thanks that similar to what i'm using http://www.w3schools.com/dom/tryit.a...t_crossbrowser and http://www.w3schools.com/dom/tryit.a...te_parsertest2

mine is a mixture of both.
Jul 21 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

10
1736
by: Tank | last post by:
First off let me say that I am by no means a skilled programmer so i probably have made a dozen mistakes in my attempt at coding my problem. I will tell you the problem so that you have an idea of what i am trying to do and I will give you my code so you can see my clusterf*ck. Here is the problem: At work I have about 20 photographers who work for me. Each one has a photo idea number (mine is 102 and my bosses is 101 and my...
6
8249
by: chuck clark | last post by:
Hi, I understand that for security and other reasons that javascript does not support writing/reading to text files. I am looking for a way that will however. This is what i am trying to do. I want to develop a simple html page that is run locally on a windows 2000 box in IE. The page will have a browse button to select a source folder, either locally or a network computer on same lan. A destination folder, either locally or a...
26
15312
by: Don | last post by:
I'm writing an html page with some JavaScript that reads a web page into a client-side temp file, then reformats it, then submits that same file as a URL to the browser for display, via "locate.replace". I can do all this if the html page containing the script originates on the client machine, but don't know how to get access to a client-side temp file when the same html page containing the script is on a web host. How do I get access...
21
66868
by: strutsng | last post by:
<input type="file"> only allows the user to browse for files. How about "browse for folder" dialog? Can html/javascript do that? I couldn't find any syntax for that. If not, please advise what are the other approaches. please advise. thanks!!
5
13305
by: Mitchell S. Honnert | last post by:
Is there a way, given the full path of a folder on a network, that one can programatically tell if you have Read access to that folder? I have an application where the user is able to select a number of search folders using the standard dialog control. There shouldn't be an issue with the search folder being on a local drive or a network drive. But if you don't have Read access to the folder, there's trouble. The user can see the...
3
2779
by: 95redtegls | last post by:
Ok here is my question Can javascript read the contents of a folder and list its path name in a array Here is what i have so far @echo off if '%1'=='w' ( echo Scenary='images/Scenary/%2'; >> array_it.js set /a items=items+1 ) else (
3
1314
by: stephen | last post by:
Hi, I have a javascript file that I want to use on a button. If I have the javascript file in the same folder as the webform then it works for eg: /SampleApp/WebForms/TestForm.aspx but I want to try to read the javascript from another folder for e.g /SampleApp/JScript/MyJavaScript.js
2
11638
hsriat
by: hsriat | last post by:
For a good programmer, providing good comments in the code is a must. In PHP, giving comments has no demerits. But what about JavaScript? Do you really want those comments to stay in the code and make it double in size, and of course disclose what you have done when the code reaches the client (browser)? I am not sure how many of you would have faced this problem, but I faced this many times. I am not good at memorizing things, so I give lot...
8
5214
by: Mateusz Viste | last post by:
Hi, I'm not sure if my question is really related to JavaScript, so please excuse me if that's not the case (and maybe you guys would have an idea what's the cause is and where could I ask)... I recently put the following script online: <script type="text/javascript"><!-- function playmedia(mediafile) { newwindow=window.open(); if (window.focus) {newwindow.focus()} newwindow.document.write('<html>');
0
9528
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10456
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10174
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9052
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7548
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5442
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4118
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2926
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.