多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
![](https://box.kancloud.cn/ddc6228d52fc8a2c83714ceaf9be110f_510x151.png) ~~~ <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>选择颜色填充方块</title> <style> div { width: 100px; height: 100px; border: 1px solid #000; float: left; margin: 10px; } </style> <script type="text/javascript" src="js/jquery-1.11.1.js"></script> </head> <body> <span>red</span> <span>yellow</span> <span>green</span> <span>blue</span> <br> <div></div> <div></div> <div></div> <div></div> <script> var color = ''; $('span').click(function () { color = $(this).html(); }) $('div').click(function () { $(this).css('background',color); }) </script> </body> </html> ~~~