1new function(){ 2 function rollover(){ 3 var targetClassName = "rollover"; 4 var suffix = "_on"; 5 6 var overReg = new RegExp("^(.+)(\\.[a-z]+)$"); 7 var outReg = new RegExp("^(.+)" + suffix + "(\\.[a-z]+)$"); 8 9 var preload = new Array(); 10 var images = document.getElementsByTagName("img"); 11 12 for (var i = 0, il = images.length; i < il; i++) { 13 var classStr = images[i].getAttribute("class") || images[i].className; 14 var classNames = classStr.split(/\s+/); 15 for(var j = 0, cl = classNames.length; j < cl; j++){ 16 if(classNames[j] == targetClassName){ 17 18 //preload 19 preload[i] = new Image(); 20 preload[i].src = images[i].getAttribute("src").replace(overReg, "$1" + suffix + "$2"); 21 22 //mouseover 23 images[i].onmouseover = function() { 24 this.src = this.getAttribute("src").replace(overReg, "$1" + suffix + "$2"); 25 } 26 27 //mouseout 28 images[i].onmouseout = function() { 29 this.src = this.getAttribute("src").replace(outReg, "$1$2"); 30 } 31 } 32 } 33 } 34 } 35 36 function addEvent(elem,event,func){ 37 if(elem.addEventListener) { 38 elem.addEventListener(event, func, false); 39 }else if(elem.attachEvent) { 40 elem.attachEvent("on" + event, func); 41 } 42 } 43 addEvent(window,"load",rollover); 44}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.