asp.net(C#) 动态添加非ASP的标准html控件(如添加Script标签)
代码如下:
HtmlGenericControl Include2 = new HtmlGenericControl("script"); Include2.Attributes.Add("type", "text/javascript"); Include2.InnerHtml = "alert('JavaScript in Page Header');"; this.Page.Header.Controls.Add(Include2);
或使用:
代码如下:
Literal li = new Literal(); li.Text = "<script...</script>"; this.Page.Header.Controls.Add(li);
相关推荐
haocxy 2020-05-28
niehanmin 2020-05-19
annan 2020-07-18
举 2020-06-27
harddays 2020-06-21
长安长夜Saint 2020-06-14
Magicsoftware 2020-06-04
soyo 2020-05-28
davidliu00 2020-05-26
coolhty 2020-05-20
无缘公子 2020-05-19
fansenjun 2020-03-01
zmosquito 2020-05-10
玫瑰小妖 2020-05-10
jianghero 2020-05-05
jocleyn 2020-05-03
angqiuli 2020-04-26
waterv 2020-04-26
wcqwcq 2020-04-22