刷(ON-OFF)按钮通过复选框,html
the Swipe (ON-OFF) button via checkbox ,html
<div class="onoffswitch">//checkbox class with css
<input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch" checked onClick="changeImage()">//checkbox class with css
<label class="onoffswitch-label" for="myonoffswitch">//checkbox class with css
<div class="onoffswitch-inner"></div>//checkbox class with css
<div class="onoffswitch-switch"></div>//checkbox class with css
</label>
</div>
<script> function changeImage() {
element=document.getElementById('myimage')
if (element.src.match("bulbon")) {
element.src="PIC/WXXL.png";
} else {
element.src="PIC/idea-xxl.png"; }
}
</script>
复选框类与CSS我只是让滑动按钮通过复选框(on - off),当我按下改变图像,但当回到关闭不改变
谁来帮帮我
试试这个: