asp.net(C#) 动态添加非ASP的标准html控件(如添加Script标签)
程序员文章站
2024-03-09 09:08:11
复制代码 代码如下:htmlgenericcontrol include2 = new htmlgenericcontrol("script"); include2.att...
复制代码 代码如下:
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);