JS实现的RGB网页颜色在线取色器完整实例
jquery的hover()函数
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("p").hover(function(){
$("p").css("background-color","yellow");
$("p").css("border","1px solid red");
alert(String($("p").width())+String($('p').height()))
},function(){
$("p").css("background-color","pink");
$("p").css("border","1px solid green");
});
});
</script>
</head>
<body>
<p>鼠标移动到该段落。</p>
</body>
</html>