<style>
input.mm
{
  over: expression(onmouseover=function(){this.style.backgroundColor="#FF0000"});
  out:  expression(onmouseout =function(){this.style.backgroundColor="#FFFFFF"});
}
</style>
<input class=mm value=梅花雪>

解决方案 »

  1.   

    onmouseover="this.style.backgroundColor=black" onmouseout="this.style.backgroundColor=white"
      

  2.   

    谢谢meizz(梅花雪) ,但是能不能光标所在的位置,背景颜色发生变化,而不是鼠标一离开,背景颜色又恢复到原来呢?我在别的网站看到过,不过那个程序写得太复杂,不知道该怎么精简
    http://expert.csdn.net/Expert/topic/2848/2848696.xml?temp=.4349176
      

  3.   

    光标放在文框里,文框的背景颜色改变
    <style>
    input.mm
    {
      over: expression(onfocus=function(){this.style.backgroundColor="#FF0000"});
      out:  expression(onblur =function(){this.style.removeAttribute("backgroundColor")});
    }
    </style>
    <input class=mm value=梅花雪>