按钮-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)
上一篇 2021年7月25日 下午5:00
下一篇 2021年7月25日 下午6:00


相关推荐

  • Lambda表达式创建线程

    Lambda表达式创建线程1 传统方式创建一个线程 传统方式 privatestati newThread newRunnable Override publicvoidru 业务代码 System out println 传统方式创建线程 Thread currentTh

    2026年3月26日
    2
  • JVM调优工具详解

    JVM调优工具详解学习了JVM的一些调优工具为大家分享一下,现在把学习笔记总结记录一下,如果记录有些错误,还望指出。文章目录前言jdk自带工具一、Jmap1.1jps1.2jmap-histo1.3jmap-heap1.4jmap-dump二、Jstack三、Jinfo四、Jstat垃圾回收统计JVM运行情况预估年轻代对象增长的速率YoungGC的触发频率和每次耗时每次YoungGC后有多少对象存活和进入老年代FullGC的触发频率和每次耗时内存泄露到底是怎么回事五、ArthasArthas使用git

    2022年5月31日
    37
  • 年龄大的普通程序员最后的出路是哪里?[通俗易懂]

    年龄大的普通程序员最后的出路是哪里?

    2022年2月11日
    66
  • Vue项目实战05:18n实现多语言自动切换-浏览器语言设置「建议收藏」

    Vue项目实战05:18n实现多语言自动切换-浏览器语言设置「建议收藏」什么是vue-i18ni18n是Internationalization这个英文的简写,即国际化的意思,vue-i18n是一款针对于vue开发的国际化插件,让项目支持多语言切换,以适应不同地区用户的需求。安装vue-i18n直接在项目中执行安装命令:npminstallvue-i18n–save​全局引入vue-i18n在项目中引入vue-i18n,实例化vue-i18n将需要加载的语言包通过require导入,这里看个人需求我只需要中英日文,所以引入zh-CN.js和en-US.j

    2022年6月4日
    37
  • 九度1465:最简真分数

    九度1465:最简真分数题目 1465 最简真分数时间限制 1 秒内存限制 128 兆特殊判题 否提交 1330 解决 551 题目描述 给出 n 个正整数 任取两个数分别作为分子和分母组成最简真分数 编程求共有几个这样的组合 输入 输入有多组 每组包含 n n 当 n 0 时 程序结束 不需要处理这组数据 输出 每行输出最简真分数组合的个数 样例输入 73

    2026年2月27日
    2
  • WIN10下 Tomcat安装及配置教程「建议收藏」

    WIN10下 Tomcat安装及配置教程「建议收藏」目录工具/原料方法/步骤注意事项工具/原料1,JDK:版本为jdk1.8我的下载文件里有,解压缩版的2,tomcat:版本为apache-tomcat-8.0.53-windows-x64.zip下载地址http://tomcat.apache.org/3,windows10,64bit方法/步骤一、安装JDK和Tomcat1,安装JDK:解压即可,…

    2022年5月12日
    49

发表回复

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

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