/**************************************************** * DOM Image rollover: * by Chris Poole * http://chrispoole.com * Script featured on http://www.dynamicdrive.com * Keep this notice intact to use it :-) * Modified by JOsh ****************************************************/ // To use, put an hsrc in an image tag with the src of the roll-over image // and/or add a csrc to add a pop up with the target href of the csrc. function init() { if (!document.getElementById) return var imgOriginSrc; var imgTemp = new Array(); var imgarr = document.getElementsByTagName('img'); for (var i = 0; i < imgarr.length; i++) { if (imgarr[i].getAttribute('hsrc')) { imgTemp[i] = new Image(); imgTemp[i].src = imgarr[i].getAttribute('hsrc'); imgarr[i].onmouseover = function() { imgOriginSrc = this.getAttribute('src'); this.setAttribute('asrc',this.getAttribute('src')) this.setAttribute('src',this.getAttribute('hsrc')) } imgarr[i].onmouseout = function() { if(!imgOriginSrc){ if( this.getAttribute('asrc') ) { imgOriginSrc=this.getAttribute('asrc'); } else { imgOriginSrc=this.getAttribute('src'); } } this.setAttribute('src',imgOriginSrc) } } } }