PDA

View Full Version : DOM Image Rollover v3.0 (a DD script)



a_design_interactive
09-20-2006, 07:47 PM
Hi there. I wanted to try the DOM Image Rollover (http://www.dynamicdrive.com/dynamicindex15/domroll.htm) on my site, but i can't figure out where i'm supposed to put my custom data.

not including the browser ID code, as far as i can tell, this is the extent of the "do-stuff with imagesf" part of the script:
var imgarr=document.getElementsByTagName('img');
var imgPreload=new Array();
var imgSrc=new Array();
var imgClass=new Array();
for (i=0;i<imgarr.length;i++){
if (imgarr[i].className.indexOf('domroll')!=-1){
imgSrc[i]=imgarr[i].getAttribute('src');
imgClass[i]=imgarr[i].className;
imgPreload[i]=new Image();
if (imgClass[i].match(/domroll (\S+)/)) {
imgPreload[i].src = imgClass[i].match(/domroll (\S+)/)[1]
}
imgarr[i].setAttribute('xsrc', imgSrc[i]);
imgarr[i].onmouseover=function(){
this.setAttribute('src',this.className.match(/domroll (\S+)/)[1])
}
imgarr[i].onmouseout=function(){
this.setAttribute('src',this.getAttribute('xsrc'))
}i stuck this on my site, and i've got that other bit in the page-- but no where that i can see is it explained where i want to enter the image data for my unique situation. i'm inclined to look for an image place-holder example in the code, but i see none. not that it MUST, but i'm used to it for example, sometmes example code would have something like:
"sample.gif" is our image and "samplehover.gif" is our hover... is there more than one page to the tutorial i'm missing somehow? or is there an "understood" aspect to these scripts (ie. a common lingo to the variables represented?) that I, as a fair-weather dynamic-driver, am not aware?

thanks!!

(aside: actually-- this DOM swapper-- seems a bit "unusual". i went for it because of the attention-to-scalability factor. i wonder what is your favorite dynamic swapper script-- for the simple purpose as an anti-spam text-as-img media swapper?)