From default Colorization to grayscale.
<Div id = "friendbox">
<A href = ""> </a>
<A href = ""> </a>
<A href = ""> </a>
<A href = ""> </a>
</Div>
<SCRIPT>
(Function (){
VaR IMGs = Document. getelementbyid ("friendbox"). getelementsbytagname ("IMG"), imgs_length = IMGs. length, I = 0;
VaR imghover = function (thenode, thesrc ){
Return function (e ){
VaR Reg = /(? : \. Jpg | \. gif | \. PNG) $/I;
VaR result = thesrc. Match (REG );
VaR resultsrc = "_ gray" + result;
VaR newsrc = thesrc. Replace (result, resultsrc );
Thenode. setattribute ("src", newsrc );
}
};
VaR imgout = function (thenode, thesrc ){
Return function (e ){
Thenode. setattribute ("src", thesrc );
}
};
For (I = 0; I VaR imgsrc = IMGs [I]. getattribute ("src ");
IMGs [I]. onmouseover = imghover (IMGs [I], imgsrc );
IMGs [I]. onmouseout = imgout (IMGs [I], imgsrc );
}
})();
</SCRIPT>
From grayscale by default to colorization.
<Div id = "friendbox" class = "friendbox Clearfix">
<A href = ""> </a>
<A href = ""> </a>
<A href = ""> </a>
<A href = ""> </a>
<A class = "last" href = ""> </a>
</Div>
<SCRIPT>
(Function (){
VaR IMGs = Document. getelementbyid ("friendbox"). getelementsbytagname ("IMG"), imgs_length = IMGs. length, I = 0;
VaR imghover = function (thenode, thesrc ){
Return function (e ){
VaR newsrc = thesrc. Replace (/_ gray /,"");
Thenode. setattribute ("src", newsrc );
}
};
VaR imgout = function (thenode, thesrc ){
Return function (e ){
Thenode. setattribute ("src", thesrc );
}
};
For (I = 0; I VaR imgsrc = IMGs [I]. getattribute ("src ");
IMGs [I]. onmouseover = imghover (IMGs [I], imgsrc );
IMGs [I]. onmouseout = imgout (IMGs [I], imgsrc );
}
})();
</SCRIPT>
From default Colorization to grayscale. [mutual conversion]