Penguen
Penguen

Reputation: 17298

How can i use js files in master pages?

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

Upvotes: 0

Views: 125

Answers (2)

stoic
stoic

Reputation: 4830

I would make use of ResolveURL:

<script type="text/javascript" src="<%= ResolveUrl("~/Engineering/EngDynamicsCreationExcel/EngJs/jquery-1.3.2.min.js") %>"></script>

Upvotes: 1

Stilgar
Stilgar

Reputation: 23571

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.

Upvotes: 0

Related Questions