DHTML Lab - dhtmlab.com - Dynamic Headline Fader, Version 3.0 | 10

Dynamic Headline Fader, Version 3.0
more on multiple headlines
The Display String
In
function FDRmakeStr(){
tempStr = "";
for (i=0;i<FDRhdlineCount;i++){
if(newsCount >= arNews.length) break;
dispStr = arNews[newsCount];
linkStr = arNews[newsCount+1];
isLink = linkStr.length;
if (isLink) {
tempStr += "<A CLASS=newslink "
+ "HREF='" + prefix + linkStr + "'>"
+ dispStr + "</A>"
}
else {
tempStr +=
(NS4) ? ("<P CLASS=nolink>"+dispStr+"</P>") : dispStr;
}
if(IE4mac) tempStr += "<BR>"
newsCount += 2;
}
return tempStr;
}
Every time the for statement is invoked, it first compares the value of newsCount (our array pointer) to the length of the arNews array. If we have reached the end of the array (
At the end of the for statement, we increment newsCount. Therefore, newsCount changes with every headline, not with every display, as it did in Version 2.01.
The Status Bar Display
With our old single-headline Fader, we tracked the user's mouse position. If it was over the Fader, we updated the browser status bar display if a transition occured. The relevant statement is in
window.status = (FDRisOver && isLink) ? (prefix + linkStr) : "";
Since there now may be more than one headline, of different lengths, this status bar update courtesy gesture should occur only when we are displaying single headlines. The statement is changed to:
if(FDRhdlineCount==1) window.status = (FDRisOver && isLink) ? (prefix + linkStr) : "";
Fader Restart Pointer
In
function FDRend(){
.
.
.
if (FDRreplayOnClick) {
startIndex = FDRendWithFirst ? 2 : 0;
.
.
.
}
}
We should make it account for multiple headlines, so that when the user double-clicks the display will update with the next headlines in the array sequence:
function FDRend(){
.
.
.
if (FDRreplayOnClick) {
startIndex = FDRendWithFirst ? (FDRhdlineCount * 2) : 0;
.
.
.
}
}
That's it for the two new features. Now back to browser-specific stuff.
Produced by Peter Belesis and
All Rights Reserved. Legal Notices.Created: Nov 30, 1999
Revised: Nov 30, 1999
URL: http://www.webreference.com/dhtml/column27/fade3hdline2.html


