html - 如何将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>
但这些都不起作用。请帮忙! 目录
解决方案
将您的替换为:
<script type="text/javascript" src="/js/index.js"></script>
推荐阅读
- google-tag-manager - 如何在 GTM + GA4 中正确跟踪测试 (UAT) 和生产数据
- windows - 远程执行powershell命令后台运行
- javascript - 在 CesiumJS 中加载 Czml 文件
- wordpress - Ninja form 致命错误我该如何修复我的网站?
- arrays - Swift:Array 是否符合序列协议?
- keras - 召回率和精度 0.00e+00
- r - 将数据从一行复制到 R data.table 中的新行
- javascript - 如何在 .NET Core MVC 中使用 AJAX 调用刷新视图
- function - CMake:从函数内定义范围中的访问变量
- javascript - 根据计算出的数字显示不同的图像