首页 > 解决方案 > 如何将html脚本引用格式化为父目录之外的文件夹

问题描述

在 html 文件中,我需要引用 html 父目录之外的脚本。附件是目录的图片。我需要从 layout.html 到 js/index.js 进行脚本引用。我试过了:

<script src = "{{ url_for('shop', filename = 'index.js') }}"> </script>
<script type="text/javascript" src="~/../js/index.js"></script>
<script type="text/javascript" src="../js/index.js"></script>
<script type="text/javascript" src="/js/index.js"></script>
<script type="text/javascript" src="index.js"></script>
<script type="text/javascript" src="~/js/index.js"></script>

但这些都不起作用。请帮忙! 目录

标签: htmlreference

解决方案


将您的替换为:

<script type="text/javascript" src="/js/index.js"></script>

推荐阅读