选中复选框后背景颜色改变效果

4个月前 (05-10 16:38)阅读回复0
大陆
大陆
  • 管理员
  • 发消息
  • 注册排名1
  • 经验值5294
  • 级别管理员
  • 主题1058
  • 回复2
楼主

复选框被选中后,背景颜色立即切换改变显示,这是一款复选框控制背景颜色特效,根据您自己的需求来自定义颜色。

<script>
function chaCloor(field){
var pig = field.checked;
pig?field.nextSibling.style.backgroundColor="yellow":field.nextSibling.style.backgroundColor="#FF0000";
}
</script>
<style>
.checkbox {
 background-Color:expression(this.checked?'yellow':'buttonface');
}
</style>
<a href="https://www.wuming.ren">武鸣人</a>,各种信息资源免费发布,分享励志语录经典短句,减肥健身常识,各种js特效代码。网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)<hr>
<!--欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。-->
<script type="text/javascript" src="https://www.wuming.ren/ad/tc.js"></script>
<script type="text/javascript" src="https://www.wuming.ren/ad/a.js"></script>
<p align="center">
<table height=50 width=148>
<tr>
 <td width="138"><input type="checkbox" onClick="chaCloor(this)"><span>选项1</span></td>
</tr>
<tr>
<td width="138"><input type="checkbox" onClick="chaCloor(this)"><span>选项2</span></td>
</tr>
<tr>
<td width="138" ><input type="checkbox" onClick="chaCloor(this)"><span>选项3</span></td>
</tr>
</table>
</p>


0
0
收藏0

本文来自武鸣人网站,转载请注明出处

本文地址:https://www.wuming.ren/a/962.html

回帖

选中复选框后背景颜色改变效果 期待您的回复!

取消
载入表情清单……
载入颜色清单……
插入网络图片

取消确定

图片上传中
编辑器信息
提示信息