【问题标题】:What is the meaning of "../" in javascript for windows path?windows路径的javascript中的“../”是什么意思?
【发布时间】:2016-10-17 12:13:00
【问题描述】:

我写了一些 HTML 和 js 代码。 我的文件夹结构是:

A => B => C.

文件夹 C 包含“index.html”文件,我想访问“emotion.js”。

A => js => 情感.js 是情感.js 的实际位置。

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

我以这种方式给出了链接。它实际上不起作用。

我只想知道“../”是什么意思?是指文件夹结构中的前一步还是根文件夹?

【问题讨论】:

    标签: javascript windows directory


    【解决方案1】:

    ../ 这将占用您一个目录,因此请使用此 2 次,例如 ../../A/js/emotion.js

    或者你可以使用 / 不使用 .. 所以无论你在哪里,这都会带你进入根目录。

    【讨论】:

      【解决方案2】:

      ../ 指父文件夹。

      如果你的文件夹结构是

      A      
        B
          C
            index.html
        js
          emotion.js
      

      然后在 index.html 中,您需要将脚本标签更改为

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

      【讨论】:

        猜你喜欢
        • 2022-09-28
        • 1970-01-01
        • 1970-01-01
        • 2023-04-03
        • 1970-01-01
        • 2012-03-12
        • 2023-04-06
        • 2011-02-08
        • 2018-02-11
        相关资源
        最近更新 更多