按钮-Button

按钮-Button

按钮添加JaveScript代码

1
按钮-Button
<
asp:Button 
ID
=”Button1″
 runat
=”server”
 Height
=”28px”
 Text
=”点我”
 Width
=”93px”


2
按钮-Buttononmouseover
=”c=this.style.backgroundColor; this.style.backgroundColor=’#00ff99′; this.style.width=’150′;”


3
按钮-Buttononmouseout
=”this.style.backgroundColor=c;this.style.width=’93’;”
 Font-Bold
=”true”
/>

按钮添加属性

按钮-Button
protected
 
void
 Button2_Load(
object
 sender, EventArgs e)
按钮-Button按钮-Button    

按钮-Button
{

按钮-Button        
按钮-Button        Button2.Attributes.Add(
onmouseoverc=this.style.backgroundColor;this.style.backgroundColor=’#00ff99′;);
按钮-Button        Button2.Attributes.Add(
onmouseoutthis.style.backgroundColor=c);
按钮-Button        Button2.Text 
= DateTime.Now.ToString();
按钮-Button    }

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

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

按钮-Button        

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

按钮-Button        

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

按钮-Button
protected
 
void
 Button2_Click(
object
 sender, EventArgs e)
按钮-Button按钮-Button    

按钮-Button
{

按钮-Button        
switch (((Button)sender).CommandName)
按钮-Button按钮-Button        
按钮-Button{

按钮-Button            
case a:
按钮-Button                lb1.Text 
= ((Button)sender).Text;
按钮-Button                
break;
按钮-Button            
case b:
按钮-Button                lb1.Text 
= ((Button)sender).Text;
按钮-Button                
break;
按钮-Button            
default:
按钮-Button                lb1.Text 
= 33333;
按钮-Button                
break;
按钮-Button        }

按钮-Button
按钮-Button    }

转载于:https://www.cnblogs.com/net123/archive/2007/12/15/996215.html

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/111060.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • Java 数组转list_java定义list数组

    Java 数组转list_java定义list数组方式一String[]array={“111″,”222″,”333”};Listlist=Arrays.asList(array);//list.add(“444”);list.remove(0);如上图所示,不可进行新增或删除元素的操作。Arrays.asList(array),返回的List是具有固定长度的私有静态内部类java.util.Arrays.ArrayList,所以…

    2022年8月23日
    6
  • 计算机系统新手入门,电脑初学者入门教程

    计算机系统新手入门,电脑初学者入门教程本篇主要从关机、任务管理器、电脑屏幕锁定这三个方面,帮助初次学习电脑的人尽快掌握一些基本操作,快一起来学习吧。工具/材料电脑(本篇以Windows7系统为例)电脑关机01方法一。首先,点击屏幕左下方的win(当点击时,会提示“开始”的字样)。02点击后,可以看见有关机选项,点击关机,后面出现几个选项,根据需要进行选择就可以。03方法二:使用快捷键。按下快捷键Alt+F4。(这里需要注意,是同时按…

    2022年6月15日
    52
  • 7、注解@Mapper、@MapperScan

    7、注解@Mapper、@MapperScan1、@Mapper注解:作用:在接口类上添加了@Mapper,在编译之后会生成相应的接口实现类添加位置:接口类上面@MapperpublicinterfaceUserDAO{//代码}如果想要每个接口都要变成实现类,那么需要在每个接口类上加上@Mapper注解,比较麻烦,解决这个问题用@MapperScan2、@MapperScan作用:指定要变成实现类的接口所在的…

    2022年5月1日
    46
  • kali 国内更新源

    kali 国内更新源#更新源编辑vi/etc/apt/sources.list(增加中科大的源或者阿里云)#获取数字签名wgetarchivekali.org/archive-key.asc#安装数字签名apt-keyaddarchive-key.asc#中科大#debhttp://mirrors.ustc.edu.cn/kalikali-rollingmainnon-freecontrib#deb-srchttp://mirrors.ustc.edu.c

    2022年5月28日
    48
  • 使用LayUI操作数据表格「建议收藏」

    使用LayUI操作数据表格「建议收藏」接着 上一篇 继续完善我们的demo,这次我们加一个搜索按钮搜索源代码地址点我在table标签的上方,加入这样一组html<divclass="demo

    2022年8月3日
    1
  • Python 递归的多种写法

    Python 递归的多种写法题目背景:让我们来看一些例子。要对一个数字列表(或者其他序列)求和,我们可以使用内置的sum函数,或者自己编写一个更加定制化的版本。这里是用递归编写的一个定制求和函数的示例defmysum(L): ifnotL: return0 else: returnL[0]+mysum(L[1:])这是一种最基本的递归写法,通过递归的方式将列表中的所有进行相加,典型的鸭子类型…

    2022年6月16日
    35

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号