I tried all the ways in the master file and in the aspx file, and in the cs file, but it never works the following are the ways i tried:
<script type="text/javascript" src='<%=ResolveUrl("~/example3.js")%>'></script>
<script language="javascript" type="text/javascript" src="example3.js">
protected void Page_PreRender(object sender, EventArgs e)
{
var scriptManager = ScriptManager.GetCurrent(Page);
if (scriptManager == null) return;
scriptManager.Scripts.Add(new ScriptReference { Path = "~/Scripts/example3.js" });
scriptManager.Scripts.Add(new ScriptReference { Path = "~/Scripts/jit.js" });
}
Try ResolveClientUrl
instead:
<script type="text/javascript" src='<%=ResolveClientUrl("~/example3.js")%>'></script>
If you still can't see it, check the page source after run (in IE, from Alt --> View --> Source), search for "example.js" and check how the path was resolved.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.