日期:2014-05-17  浏览次数:21076 次

鼠标移上去,背景图片换一下,这个代码怎么写呀?高手们?
鼠标移上去,背景图片换一下,这个代码怎么写呀?高手们?像微软的网站中的搜索部份
http://office.microsoft.com/zh-cn/FX100647102052.aspx?pid=CL100569832052

------解决方案--------------------
这个是js的效果...
在onmouseover事件里面改变图片的src...
------解决方案--------------------

<script language= "javascript ">
var image1 = new Image(109,115);--加载图片109,115为图片长宽
image1.src= "img/1.gif ";
var image2 = new Image(109,115);
image2.src= "img/2.jpg ";
function set()
{
var photos=document.frm.photo.value;
switch(photos)
{
case "img/1.gif ":
imgs.src = image1.src;
break;
case "img/2.jpg ":
imgs.src = image2.src;
break;
}
}

</script>
<img id= "img " src= " " onmouseover= "set() ">
------解决方案--------------------
<script language= "javascript ">
function over()
{
document.getElementById( "img ").background= "图片路径 ";
}
function out()
{
document.getElementById( "img ").background= "图片路径 ";
}
</script>

<td id= "img " height= "100 " background= "图片路径 " onmouseover= "over(); " onmouseout= "out(); "> &nbsp; </td>

------解决方案--------------------
onmouseover();onmouseout()