如何为复选框应用事件处理程序 [英] How to apply an event handler for a checkbox

查看:57
本文介绍了如何为复选框应用事件处理程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在下面的代码中,我想知道如何在后面的代码中为函数引发事件处理程序。



< html xmlns =   http://www.w3.org/1999/xhtml> 

< section>
< div class = checkboxFour >
< input type = 复选框 value = 1
style = margin-top:287px; margin-left:335px id = checkboxFourInput name = />
< label for = checkboxFourInput > < / label >
< / div >
< / section >
< style type = text / css >
.checkboxFour label {
display:block;
宽度:30px;
身高:30px;
border-radius:100px;
-webkit-transition:全部.5s轻松;
-moz-transition:全部.5s轻松;
-o-transition:全部.5s轻松;
-ms-transition:全部.5s轻松;
过渡:全部.5s轻松;
cursor:pointer;
仓位:绝对;
top:335px;剩余
:335px;
z-index: 1 ;
背景:#333;
-webkit-box-shadow:inset 0px 1px 3px rgba( 0 0 ,< span class =code-digit> 0
0 5 );
-moz-box-shadow:inset 0px 1px 3px rgba( 0 0 ,< span class =code-digit> 0 , 0 5 );
box-shadow:inset 0px 1px 3px rgba( 0 0 0 0 5 );
}
.checkboxFour输入[type = checkbox]:选中+标签{
背景:#26ca28;
}
< / style >

解决方案

使用复选框的任何事件右键单击复选框,然后单击属性,然后单击事件并双击您想要使用的任何事件以获取更多详细信息,请参阅此 CheckBox事件


使用onchange事件复选框。



调用codebehid函数



看到这个链接



http://taraksworld.blogspot.in/2012/05/different-ways-for-calling-code-behind.html [< a href =http://taraksworld.blogspot.in/2012/05/different-ways-for-calling-code-behind.html\"target =_ blanktitle =New Window> ^ ]

In the following code I would like to know how to raise an event handler for function in code behind.

<html xmlns="http://www.w3.org/1999/xhtml">

<section>
  	<div class="checkboxFour">
  		<input type="checkbox" value="1"   
  		 style=" margin-top:287px; margin-left:335px" id="checkboxFourInput" name=""  />
	  	<label for="checkboxFourInput"></label>
  	</div>
</section>
<style type="text/css">
.checkboxFour label {
	display: block;
	width: 30px;
	height: 30px;
	border-radius: 100px;
	-webkit-transition: all .5s ease;
	-moz-transition: all .5s ease;
	-o-transition: all .5s ease;
	-ms-transition: all .5s ease;
	transition: all .5s ease;
	cursor: pointer;
	position: absolute;
	top: 335px;
	left: 335px;
	z-index: 1;
	background: #333;
	-webkit-box-shadow:inset 0px 1px 3px rgba(0,0,0,0.5);
	-moz-box-shadow:inset 0px 1px 3px rgba(0,0,0,0.5);
	box-shadow:inset 0px 1px 3px rgba(0,0,0,0.5);
}
.checkboxFour input[type=checkbox] :checked + label { 
	background: #26ca28;
}
</style>

解决方案

To use any event of checkbox Right Click on Check box then click on properties and then click on event and double click on whatever event you want to use for more details see This CheckBox Events


use onchange event for checkbox.

To call codebehid function

see this link

http://taraksworld.blogspot.in/2012/05/different-ways-for-calling-code-behind.html[^]


这篇关于如何为复选框应用事件处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆