/*Programming language: Java Script* *Requirements: IE 4+, Netscape 6+, Mozilla and all other Dom capable browsers* */ function TSlinkrotation () { // fill the linklist with your links this.addLink = addLink; // change the link this.rotateLink = rotateLink; // loop the rotateLink() function this.start = function() { // check if browser supports javascript and start rotation if browser does if (document.all || document.getElementById) { //setInterval(this.objName+'.rotateLink()', this.refreshTime); setTimeout(this.objName+'.rotateLink()',0);//Must show at time 0; setInterval(this.objName+'.rotateLink()', this.refreshTime); } } } function NormalRotation(divName) { this.linklist = new Array(); this.parameter = new Array(); this.linktype = new Array(); // give every linkrotation object an unique name this.objName = "linkrotation" + (TSlinkrotation.id++); eval(this.objName + "=this"); this.refreshTime = 6 * 1000; this.divName = divName; this.currentIndex = -1; this.setCurrentIndex = function() { if (this.currentIndex >= this.linklist.length - 1) this.currentIndex = 0; else this.currentIndex++; } } NormalRotation.prototype = new TSlinkrotation; /* support functions */ function addLink(link,parameter,type) { this.linklist[this.linklist.length] = link; this.parameter[this.parameter.length] = parameter; this.linktype[this.linktype.length] = type; } function rotateLink() { this.setCurrentIndex(); if (document.getElementById && document.createRange) { // Netscape 6+, Mozilla // we can use the W3C DOM var range = document.createRange(); // search the
in the webpage var div = document.getElementById(this.divName); range.setStartBefore(div); // prepare the new link var currentLink = range.createContextualFragment(this.linklist[this.currentIndex]); // remove the old link while (div.hasChildNodes()) div.removeChild(div.lastChild); // write the new link into the webpage div.appendChild(currentLink); } else if (document.all) { // Internet Explorer 4+, Opera (does not support DHTML) // we have to use the ms object model eval('document.all.'+this.divName+'.innerHTML = this.linklist[this.currentIndex]'); if (this.linktype[this.currentIndex]=='Another') { setTimeout('shrinkHide(panExpand)',3*1000); // setTimeout('shrinkHide(panExpand)',100); } } } TSlinkrotation.id = 0; function makevisible(cur,which){ if (which==0) cur.filters.alpha.opacity=100 else cur.filters.alpha.opacity=80 }