两个文本框,
第一个是鼠标点击了才会变成黄色,鼠标在别的地方在点击就是白色了,
第二个是鼠标移过去就变成黄色了,鼠标一离开就变成白色了.
改变文本框的背景色。
<body>
<input name=test οnblur="changebg(this,'white')" οnfοcus="changebg(this,'yellow')">
<script>
function changebg(obj,color){
obj.style.backgroundColor=color
}
</script>
<input type=text οnmοuseοver="this.style.background='yellow'" οnmοuseοut="this.style.background='white'">
</body>
第一个是鼠标点击了才会变成黄色,鼠标在别的地方在点击就是白色了,
第二个是鼠标移过去就变成黄色了,鼠标一离开就变成白色了.
改变文本框的背景色。
<body>
<input name=test οnblur="changebg(this,'white')" οnfοcus="changebg(this,'yellow')">
<script>
function changebg(obj,color){
obj.style.backgroundColor=color
}
</script>
<input type=text οnmοuseοver="this.style.background='yellow'" οnmοuseοut="this.style.background='white'">
</body>