動態調用js文件

 
发表于:2007-10-29 15:46:124楼 得分:0
.aspx
C# code


<HEAD>
<title>WebForm1</title>
<asp:placeholder id="myplaceholder" runat="server"></asp:placeholder>
</HEAD>


.cs
C# code


private void Button2_Click(object sender, System.EventArgs e)
{
System.Web.UI.Control a
= Page.FindControl("myplaceholder");
System.Web.UI.HtmlControls.HtmlGenericControl objLink
= new HtmlGenericControl("script");
objLink.Attributes.Add(
"language","javascript");
objLink.Attributes.Add(
"src","1.js");//这个地方你自己用变量控制
objLink=objLink;
a.Controls.Add(objLink);
}

posted @ 2007-10-29 17:47  attitudedecidesall  Views(263)  Comments(0Edit  收藏  举报