Dynamically referencing a javascript file
Kinda related to my first question, my site runs fine locally but as soon as I deploy to IIS the javascript file/s are not being called properly.
In the <head>
tag of my Master
page:
<script src='/Assets/jquery-1.4.2.min.js' type="text/javascript"></script>
<script src='/Assets/hoverIntent.js' type="text/javascript"></script>
<script src='/Assets/superfish.js' type="text/javascript"></script>
<script src='/Assets/supersubs.js' type="text/javascript"></script>
This works on visual studio dev server but not on IIS. I tried adding ~
an开发者_如何学Cd saying runat="server"
but it just gives some jquery error ("Unexpected character '\'" on Line 18 of the minified jquery) when trying to run it.
Use Page.ResovleUrl
for all of your files:
<script src='<%# Page.ResolveUrl("~/Assets/jquery-1.4.2.min.js")%>' type="text/javascript"></script>
精彩评论