|
www.insideDHTML.com
Inside Dynamic HTML | Fun and Games | The 10K Demo | XML Online | CSS Online | Resources Write Once! | DHTML Toolkits | Inside Techniques | Inside Scriptlets |
|
switcho() Function The switcho() function makes switches through a series of text, links, or images. This can be used to make rotating ad banners or other items where you want items to dynamically switch themselves. This function can do three things
In the function For example, to rotate a set of links:
The above can also be accomplished by:
ExampleMicrosoft.Comswitcho() Function
function switcho(x, t, c) {
if (x.selNum == null) {
x.texts = new Array();
x.currText = "";
x.currNum = 0;
x.selNum = 0;
x.Len = 0;
for (x.i = 0; x.i < t.length; x.i++) {
if (t.charAt(x.i) == ",") {
x.texts[x.currNum] = x.currText;
x.currText = "";
x.currNum++;
x.i++;
}
x.currText = x.currText + t.charAt(x.i);
}
x.texts[x.currNum] = x.currText;
x.Len = x.currNum;
}
if (x.selNum < x.Len) {
x.selNum = x.selNum + 1;
} else {
x.selNum = 0;
}
if (x.tagName == "A") {
x.href = x.texts[x.selNum];
} else if (x.tagName == "IMG") {
if (x.style.filter = "") {
d = (c - 5) / 10;
if (d > 5) d = 5;
x.style.filter = "blendTrans(duration=" + d + ")";
} else {
d = (c - 5) / 10;
if (d > 5) d = 5;
x.style.filter = x.style.filter + "blendTrans(duration=" + d + ")";
}
x.filters.blendTrans.Apply();
x.src = x.texts[x.selNum];
x.filters.blendTrans.Play();
} else {
x.innerHTML = x.texts[x.selNum];
}
ab1 = window.setTimeout("switcho(" + x.id + ",'" + t + "'," + c + ");", c * 100);
}
Copyright © 1997-98 InsideDHTML.com, LLC. |