window.onload = rolloverInit;
//加载窗体时触发事件

function rolloverInit()...{
for (var i=0; i<document.images.length; i++)...{
if(document.images[i].parentNode.tagName=="A")...{
setupRollover(document.images[i]);
}
}
}
//对所有包含超级连接的图片执行滚动设置


function setupRollover(thisImage)...{
thisImage.outImage = new Image();
thisImage.outImage.src = thisImage.src;
thisImage.onmouseout = rollOut;
thisImage.overImage = new Image();
thisImage.overImage.src = thisImage.id + "_on.jpg";
thisImage.onmouseover = rollOver;
}
//为图片设置了out和over两种模式和相应的图片,可根据需要实际添加或修改


function rollOver()...{
this.src = this.overImage.src;
}

function rollOut()...{
this.src = this.outImage.src;
}相应在HTML中要对脚本进行引用,同时需要滚动效果的图片应包含在超连接<a herf="..."></a>中
1157



被折叠的 条评论
为什么被折叠?



