<!DOCTYPE html>
<head>
<script>
window.onload = function(){
var img = document.getElementById("imgTest");
if (document.addEventListener){
img.addEventListener("mouseover",doMouseover,false);
img.addEventListener("mouseout",doMouseout,false);
}
else if(document.attachEvent){
img.attachEvent("mouseover",doMouseover);
img.attachEvent("mouseout",doMouseout);
}
else{
img.onmouseover = doMouseover;
img.onmouseout = doMouseout;
}
}
function doMouseover(){
this.width = this.width * 1.5;
this.height = this.height * 1.5;
}
function doMouseout(){
this.width = this.width / 1.5;
this.height = this.height / 1.5;
}
</script>
</head>
<body>
<img id = "imgTest" src = "img/barcode.jpg"/>
</body>
</html>
追问这好像只能改一张图片啊?怎么改多张?
追答想实现什么效果能不能具体些?
追问就是想把多个图片做成一个宣传栏的类型,鼠标指上去,图片在指定的区域内放大显示。
追答为每张图片注册mouseover和mouseout事件就可以了。
追问这个,我不会啊,麻烦你说清楚点嘛。