IT:AD:JScript:Include

  • Script Include statements must not be autoclosed, or things go weird in some browers.
  • Script Include statement always includes src, type="text/javascript"
  • From ASP.NET, use this.ResolveClient() to resolve urls:

    <script src="<%=this.ResolveClientUrl("~/client/scripts/jquery-ui-1.8.9.xact/js/jquery-1.4.4.min.js") %>" type="text/javascript" ></script>

    • Note that Css will work fine if wrapping Head is runat=server:
      <link href="~/client/scripts/jquery-ui-1.8.9.xact/css/custom-theme/jquery-ui-1.8.9.custom.css" rel="Stylesheet" type="text/css" /> <script src="<%=this.ResolveClientUrl("~/client/scripts/jquery-ui-1.8.9.xact/js/jquery-1.4.4.min.js") %>" type="text/javascript" ></script>
  • Important:* '~/' is not processed on Link methods unless head has runat=server.
    ## ASP.NET Script Registration ## * Scripts can be registered in an ASP.NET page using: * Page.ClientScript.RegisterClientScriptInclude * Adds a ref to an external Script File. * Adds a script block at the top of the rendered page. * Page.ClientScript.RegisterScriptBlock * For inserting a chunk of Script. * Output is at top of page. * Optionally can include script tags. * Page.ClientScript.RegisterStartupScript * For inserting a chunk of Script. * Output is at bottom of page. * Optionally can include script tags. * Page.ClientScript.RegisterClientScriptResource * For inserting a resource as a chunk of Script. * Resource has to be tagged with WebResourceAttribute
    [assembly: WebResource("Samples.AspNet.CS.Controls.script_include.js", "application/x-javascript")] * Resource will be served by: WebResource.axd / GetWebResourceURL. * Output is at … * Wraps output in script (not-optional). * See: Page.ClientScript.GetWebResourceUrl
  • /home/skysigal/public_html/data/pages/it/ad/jscript/include.txt
  • Last modified: 2023/11/04 03:26
  • by 127.0.0.1