处理图像2

].parentNode',document.images[i].parentNode.tagName)
if (document.images[i].parentNode.tagName=="A"){
setupRollover(document.images[i]);
}
}
}

function setupRollover(thisImage) {
// console.log('setupRollover',thisImage)
var defaultUrl = thisImage.src;
thisImage.onmouseover=function () {
//console.log('vghgg')
thisImage.src="../img/"+thisImage.id+"arrow.jpg";
}

thisImage.onmouseout=function () {
    thisImage.src=defaultUrl;
}

thisImage.onclick=function() {
    thisImage.src="../img/"+thisImage.id+"three.gif";
}

}




 ###4.由链接触发翻转器
html:










link Rollover



Next page


arrow




js:




window.onload=rolloverInit;
function rolloverInit() {
for(var i=0;i var defaultlink=document.links[i];
if (defaultlink) {
var defaultimg=document.getElementById(defaultlink.id+"Img");
if(defaultimg){
setupRollover(defaultlink,defaultimg);
}
}
}
}

function setupRollover(thisLink,thisImg){
var defaultUrl=thisImg.src;
thisLink.onmouseover=function(){
thisImg.src="../img/red"+thisLink.id+".jpg";
}

thisImg.onmouseout=function(){
    thisImg.src=defaultUrl;
}

thisImg.onclick=function(){
    thisImg.src="../img/green"+thisLink.id+".jpg";
}

}

你可能感兴趣的:(处理图像2)