如何在母版页中使用 js 文件?
我有一个母版页。我尝试添加js文件。 vs 编辑器不绘制绿色。但不影响我的js页面。我不能使用下面的js。 src怎么写? (我可以使用 pickurl)但我在页面上看不到 js 的效果,
<script src="Engineering/EngDynamicsCreationExcel/EngJs/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="../Engineering/EngDynamicsCreationExcel/EngJs/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="../../Engineering/EngDynamicsCreationExcel/EngJs/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="~/Engineering/EngDynamicsCreationExcel/EngJs/jquery-1.3.2.min.js" type="text/javascript"></script>
我在下面添加了我的 js 文件图片。我还在 MroTechnic 中有一个 MasterPage
i have a master page. i try to add js files. vs editor is not draw green color. But no affect my pages with js. i can not use below js. How can i write src? (i can use pickurl) but i don't see effects of js on page
<script src="Engineering/EngDynamicsCreationExcel/EngJs/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="../Engineering/EngDynamicsCreationExcel/EngJs/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="../../Engineering/EngDynamicsCreationExcel/EngJs/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="~/Engineering/EngDynamicsCreationExcel/EngJs/jquery-1.3.2.min.js" type="text/javascript"></script>
i added my js files pic below. Also i have a MasterPage in MroTechnic
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我会使用 ResolveURL:
I would make use of ResolveURL:
问题可能是您的实际页面与母版页具有不同的路径,这使得路径无效。一种解决方案是使用 ScriptManager 并使用相对路径加载脚本。
Probably the problem is that your actual pages have different path than the master page which makes the path invalid. One solution would be to use ScriptManager and load the scripts with relative paths.