几种鼠标触发CSS事件

时间:2022-05-15 22:39:33

onMouseDown 按下鼠标时触发

onMouseOver 鼠标经过时触发

onMouseUp 按下鼠标松开鼠标时触发

onMouseOut 鼠标移出时触发

onMouseMove 鼠标移动时触发

onMouseLeave  鼠标指针移除触发

onMouseEnter 鼠标指针移动到对象内时触发

placeholder 占位符

<style>

  .f1{color:#ccc;}

  .f2{color:#000;}

</style>

<div>

  <input placeholder="婷" class="f1" onMouseDown="this.className='f2'" onMouseOver="this.className='f1'" />

</div>