按钮添加JaveScript代码

<
asp:Button
ID
=”Button1″
runat
=”server”
Height
=”28px”
Text
=”点我”
Width
=”93px”
2

=”c=this.style.backgroundColor; this.style.backgroundColor=’#00ff99′; this.style.width=’150′;”
3

=”this.style.backgroundColor=c;this.style.width=’93’;”
Font-Bold
=”true”
/>
按钮添加属性

protected
void
Button2_Load(
object
sender, EventArgs e)



{





按钮CommandName属性
PS:三个按钮同时触发button2_Click事件,根据事件惩罚者((Button)sender)的CommandName来判断

<
asp:Button
ID
=”Button2″
runat
=”server”
CommandName
=”a”
OnClick
=”Button2_Click”
Text
=”小明”
OnLoad
=”Button2_Load”
/>

<
asp:Button
ID
=”Button3″
runat
=”server”
CommandName
=”b”
OnClick
=”Button2_Click”
Text
=”小里”
/>

<
asp:Button
ID
=”Button4″
runat
=”server”
CommandName
=”c”
OnClick
=”Button2_Click”
Text
=”小王”
/>

protected
void
Button2_Click(
object
sender, EventArgs e)



{
















转载于:https://www.cnblogs.com/net123/archive/2007/12/15/996215.html
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/111060.html原文链接:https://javaforall.net