<div οnmοusedοwn="mDown(this)" οnmοuseup="mUp(this)" style="background-color:deeppink;width:90px;height:20px;padding:40px;"></div>
引入:<script src="jquery.min.js"></script>
jQuery代码:
<script>
function mDown(obj) {
obj.style.backgroundColor = "#ff0000";
obj.innerHTML = "松开鼠标";
}
function mUp(obj) {
obj.style.backgroundColor = "#00fffc";
obj.innerHTML = "点击鼠标";
}
</script>
这是之前的代码,原链接我忘了