Jan
4
勾选后背景变色的样式:
<html>
<head>
<script>
function chaCloor(field){
var pig = field.checked;
pig?field.nextSibling.style.backgroundColor="yellow":field.nextSibling.style.backgroundColor="#fff";
}
</script>
<style>
.checkbox {
background-Color:expression(this.checked?'yellow':'buttonface');
}
</style>
</head>
<body >
<div>
<input type="checkbox" onClick="chaCloor(this)"><span>选项1</span>
<input type="checkbox" onClick="chaCloor(this)"><span>选项2</span>
<input type="checkbox" class="checkbox">
<input type="checkbox" class="checkbox">
</div>
</body>
</html>
预览效果
<html>
<head>
<script>
function chaCloor(field){
var pig = field.checked;
pig?field.nextSibling.style.backgroundColor="yellow":field.nextSibling.style.backgroundColor="#fff";
}
</script>
<style>
.checkbox {
background-Color:expression(this.checked?'yellow':'buttonface');
}
</style>
</head>
<body >
<div>
<input type="checkbox" onClick="chaCloor(this)"><span>选项1</span>
<input type="checkbox" onClick="chaCloor(this)"><span>选项2</span>
<input type="checkbox" class="checkbox">
<input type="checkbox" class="checkbox">
</div>
</body>
</html>
预览效果

不要误解web标准,不要

对《细节看体验(1)》有 0 条评论