Hi I'm pretty new to HTML and JavaScript and I was wondering how to src to a file in a folder within a folder?
Any help would be appreciated.
To be more specific I'm trying to access a JavaScript library in a folder named yui and which is another folder named libraries.
<script src='./folderwithinfolder/file.js'></script>
To break it down:
./ = folder this file is in.
folderwithinfolder/= A folder within the folder the webpage is in.
file.js = Javascript File.
You can change the SRC to follow where you want to go the folders:
libraries/yui/your-library-name-here.js
Related
I am struggling to understand how to export the generated images from this script to the folder where the html has been exported.
I have slightly edited the original script to get the output folder as the name of the .ai file, the html file is working fine and is placed inside this folder, but the images are exported outside this folder.
This is the edited script: https://js.do/code/403281
Thank you so much,
I have created Dynamic web project and it has .html, .css and .js files. I group these file in respective folders like .js file in javascripts folder and .html file in views folder but i don't able to access these file in project. I used eclipse IDE for this. Is there need to configure path for these folder?
You need to put the JSP file in /index.jsp instead of in /WEB-INF/jsp/index.jsp. This way the whole servlet is superflous by the way.
WebContent
|-- META-INF
|-- WEB-INF
| -- web.xml
-- index.jsp
If you're absolutely positive that you need to invoke a servlet this strange way, then you should map it on an URL pattern of /index.jsp instead of /index. You only need to change it to get the request dispatcher from request instead of from config and get rid of the whole init() method.
These are not Java source files, so it makes no sense to configure them as such. By default in a Dynamic Web Project you only see the src folder under Java Resources. Other folders will be listed at the bottom of the tree. This is by design.
Or if you meant, that you do not see them when you move into the folder by an external file manager: press F5 on the project.
Its based on from which file you are trying to access those files.
If it is in the same folder where your working project file is, then you can use just the file name. no need of path.
If it is in the another folder which is under the same parent folder of your working project file then you can use location like in the following /javascript/sample.js
In your example if you are trying to access your js file from your html file you can use the following location
../javascript/sample.js
the prefix../ will go to the parent folder of the file(Folder upward journey)
I got answer to my question...
Now my directory structure is
WebContent
--javascripts
--stylesheets
--viwes
--META-INF
--WEB-INF
Note: view contain html files
To change path of my welcome html file i made bit change in web.xml present in WEB-INFfolder.
<welcome-file-list>
<welcome-file>/views/welcome.html</welcome-file>
</welcome-file-list>
Hi i wanted to upload folder and move to some destination is it possible doing in php ? or at least i can read the folder name and create same folder in divination and copy all files into created folder.
You can do this with the new HTML5 directory capabilities. Just put the directory attributes in your input field. After you got the directory server-side, you can do everything you want with it.
URL for a simple guide:
http://www.w3bees.com/2013/03/directory-upload-using-html-5-and-php.html
I have one .js file named final.js which I copied as bundle resource I have a requirement like the html document which reads this js file should download at runtime and store it in documents directory. But the js file is not able to read by the html when I loaded it in webview, because of the path of .js file.
I tried with the solution like below, but not worked.
<script src ="./final.js"> </script>
And finally I tried to copy the hardcoded path of application bundle like below, now it worked. Finally I come to know that the path is not proper.
> <script src ="/Users/unknownUser/Library/Application Support/iPhone
> Simulator/7.0/Applications/025EF3B6-F2E6-4162-8921-839D7D98FF58/HTMLGetdataTestApp.app/final.js">
> </script>`
Can any one tell me that how a html file which is stored in documents directory can read a .js file which is stored in main bundle with the correct path instead of hardcoded like above.
The simple solution will be copying the final.js file to documents directory.
Copy the js file from bundle to the document directory (where the html page is located) and set the path as:
<script src ="final.js"> </script>
I have a folder called projects and in it I have a game folder and an engine folder. I have my engine.js file inside the engine folder and I was wondering if I could access it with my game.html file from the other folder like so
<script type ="text/javascript" src ="\engine/engine.js"/>
Now, obviously the above doesn't work, but what I need to do is go back out of the game folder to the project folder and then into the engine folder.
File tree: projects folder
projects
engine
engine.js
game
game.js
What is the proper format for src to provide users with a link to engine.js?
Use a double-dot to go back:
src="../engine/engine.js"
That would be:
<script type ="text/javascript" src ="../engine/engine.js"/>