HTML用ONMOUSEOVER,ONMOUSEOUT改变背景色或背景图片的方法

1.用onmouseout  onmouseover 图像间相互变换:

<image src="img1" onmouseover="this.src='img2'" onmouseout="this.src='img1'">

 

2.onmouseover  onmouseout 改变文字背景色:

<div width="100" height="100" onmouseover="style.backgroundColor='#fff'"

onmouseout="style.backgroundColor='#bbb'" bgcolor="#bbb">文字</div>


3..onmouseover  onmouseout 改文字变背景图:

<div width="100" height="100" onMouseOver="this.background='1.gif'"

onMouseOut="this.background='2.gif'" background="2.gif">文字</div>

你可能感兴趣的:(onmouseover)