# IT:AD:JScript:Include # * [[../|(UP)]] {{indexmenu>.#2|nsort tsort}} Including Scripts on the page is the bare essential step to using JScript -- yet with ASP.NET, etc. time is lost... ## Include Statements ## * Script *Include* statements must not be autoclosed, or things go weird in some browers. * Script *Include* statement always includes `src`, `type="text/javascript"` ## ASP.NET Includes ## * From ASP.NET, use *this.ResolveClient()* to resolve urls: `` * Note that Css will work fine if wrapping Head is runat=server: ` ` * ***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`