<style type="text/css"> #cursor_control { position: absolute; left: 0; height: 20px; width: 20px; border:#000 5px solid; border-radius:20%; } .color_board { padding:15px; width:50px; height:200px; float:left; margin:1px; border:whitesmoke 5px solid; } #black { background:black; color:white; } #green { background:green; color:white; } #yellow { background:yellow; } #red { background:red; } #empty_board { float:left; padding:15px; height:200px; width:250px; border:#000 5px solid; } </style>
<script type="text/javascript"> var tryColorPicker = document.getElementById("colorPicker_frame"); tryColorPicker.addEventListener('mousemove',function(event) { $("#cursor_control").css({'top':event.pageY+'px','left':event.pageX+'px'}); }); function transferColor(){ $("#empty_board").css('background-color',$("#cursor_control").css('background-color')); } function chooseColor(id){ $("#cursor_control").css('background-color',id); } </script>