欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

js實現(xiàn)選中復選框文字變色的方法

 更新時間:2015年08月14日 09:33:44   作者:企鵝  
這篇文章主要介紹了js實現(xiàn)選中復選框文字變色的方法,涉及javascript鼠標事件及頁面元素的相關(guān)操作技巧,具有一定參考借鑒價值,需要的朋友可以參考下

本文實例講述了js實現(xiàn)選中復選框文字變色的方法。分享給大家供大家參考。具體如下:

這里實現(xiàn)選中復選框時,文字加上一個背景色,變通一下,還是很有用的。

運行效果如下圖所示:

在線演示地址如下:

http://demo.jb51.net/js/2015/js-checkbox-cha-font-color-codes/

具體代碼如下:

<html>
<head>
<title>選中復選框文字變色</title>
<style>
.checkbox {
 background-Color:e-xpression(this.checked?'yellow':'buttonface');
}
</style>
</head>
<script>
function chaCloor(field){
var pig = field.checked;
pig?field.nextSibling.style.backgroundColor="skyblue":field.nextSibling.style.backgroundColor="white";
}
</script>
<body>
<table height=48 width=136>
<tr>
 <td><input type="checkbox" onClick="chaCloor(this)"><span>網(wǎng)頁特效</span></td>
</tr>
<tr>
<td><input type="checkbox" onClick="chaCloor(this)"><span>源碼下載</span></td>
</tr>
<tr>
<td><input type="checkbox" onClick="chaCloor(this)"><span>編程軟件</span></td>
</tr>
</table>
</body>
</html>

希望本文所述對大家的javascript程序設(shè)計有所幫助。

相關(guān)文章

最新評論