初始化文本框、按钮的效果函数。
注释很清楚我就不多说了。
程序代码:
.btnadd_1
{
font-size: 12px;
width: 80px;
height: 22px;
background-image: url(images/btn/btnadd_1.gif);
border: none;
padding-top: 3px;
cursor:hand;
}
.btnadd_2
{
font-size: 12px;
width: 80px;
height: 22px;
background-image: url(images/btn/btnadd_2.gif);
border: none;
padding-top: 3px;
cursor:hand;
}
程序代码:
/// <summary>
/// 控件效果
/// </summary>
/// <param name="ctrls">控件数组,一种类型控件数组,目前只支持button,textbox两种类型控件,比如control ctrls={btn_add,btn_save}</param>
/// <param name="type1">样式类型1,button控件,支持鼠标滑过onmouseover和鼠标滑开两种效果,textbox控件,支持鼠标获得焦点onfocus和失去焦点两种效果</param>
/// <param name="type2">样式类型2</param>
public void ctrlattributes(control [] ctrls,string type1,string type2)
{
for (int i=0;i<ctrls.length;i++)
{
if (ctrls[i] is textbox)
{
((textbox)ctrls[i]).attributes.add("class",type1);
((textbox)ctrls[i]).attributes.add("onfocus","classname="+type2+"");
((textbox)ctrls[i]).attributes.add("onblur","classname="+type1+"");
}
if (ctrls[i] is button)
{
((button)ctrls[i]).attributes.add("class",type1);
((button)ctrls[i]).attributes.add("onmouseover","classname="+type2+"");
((button)ctrls[i]).attributes.add("onmouseout","classname="+type1+"");
}
}
}