简体   繁体   中英

What is the meaning of “../” in javascript for windows path?

I have written some HTML and js code. My folder Structure is :

A => B => C .

Folder C contains 'index.html' file and I want to access 'emotion.js'.

A => js => emotion.js is the actual place for emotion.js.

"<script src=\"../js/emotion.js\">"

I have given the link this way. It is not working actually.

I just want to know what "../" means? It is refers to one step before in the folder structure or the root folder?

../ refers to the parent folder.

If your folder structure is

A      
  B
    C
      index.html
  js
    emotion.js

Then inside index.html you will need to change the script tag to

    <script src="../../js/emotion.js">

../ this will take you up one dir so use this 2 times eg ../../A/js/emotion.js

or you can use / without .. so this will take you to root no matter where you are .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM