后台动态添加js文件到head里 rt找了好久,好像没个方法或属性。上来问问。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 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); <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); } } <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); HtmlGenericControl js = new HtmlGenericControl("script");js.Attributes.Add("type", "text/javascript");js.Attributes.Add("src", "js文件路径");Page.Header.Controls.Add(js); 打开设计模式时报错:cannot load fpcutl.dll 请教:在网页嵌套word!!! menu控件URl问题 发布一下我所写的权限系统 谁有股票源代码呢? Access to the path :......is denied. 大家好,我是初学ASP.NET的。我想问一下大家WIN XP HOME版本的到底能不能装ISS? -------sohu blog的上传图片功能是怎样做的? 小弟问个问题 我用的VS2005自带的SQL为什么在数据库中删除的项目仍然不能创建同名的数据库呢? 簽核設計問題:動態產生鏈接 如何在插入数据后,返回非自增字段的数据呢?
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);
<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);
}
}
<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);
HtmlGenericControl js = new HtmlGenericControl("script");
js.Attributes.Add("type", "text/javascript");
js.Attributes.Add("src", "js文件路径");
Page.Header.Controls.Add(js);