rt
找了好久,好像没个方法或属性。上来问问。

解决方案 »

  1.   

    Page.ClientScript.RegisterClientScriptInclude("A", "A.js");
     this.Page.ClientScript.RegisterClientScriptInclude(this.Page.GetType(), "A", "A.js");HtmlGenericControl Include2 = new HtmlGenericControl("script"); 
    Include2.Attributes.Add("type", "text/javascript"); 
    Include2.InnerHtml = ""; 
    this.Page.Header.Controls.Add(Include2);
      

  2.   

      
      <Head Id="PageHeader" Runat="Server">
      <Meta Name="keyword" content="business,company">
      </head>
      
      private void InitScript()
      {
      Control C=this.FindControl("PageHeader");
      if (c!=null)
      {
      Literal l=new Literal();
      l.Text=BuilderJs();//BuilderJs返回一段JS代码
      c.Controls.Add(l);
      }
      }
      

  3.   


    <head runat="server">
        <title>Page</title>
    <asp:PlaceHolder ID="ph" runat="server"></asp:PlaceHolder>    
    </head>HtmlGenericControl objScript = new HtmlGenericControl("script");            objScript.Attributes["type"] = "text/javascript";
                objScript.Attributes["src"] = "Script.js";            ph.Controls.Add(objScript);
      

  4.   


    HtmlGenericControl js = new HtmlGenericControl("script");
    js.Attributes.Add("type", "text/javascript");
    js.Attributes.Add("src", "js文件路径");
    Page.Header.Controls.Add(js);