...

View Full Version : News Ticker Problem #2



fidgen
04-21-2005, 12:26 PM
Hi,

Sorry, I'm still struggling with this damn ticker thingy :confused:

My problem now, is that after the first cycle, the news loses the spacing between the seperate items and appears as one crunched up mess.

The ticker source is from this site:
http://www.sharepointcustomization.com/resources/codesamples/NewsScroller/default.htm

And they recommend

Separators
Probably the easiest way to insert separators, like horizontal rules or images, between the news items, would be to append the HTML to display the separator to the news items HTML itself. This can easily be done in the NewsScroller_RenderChildren() function in the newsscroller.js source file.


Which to be honest has had me flummoxed.

Heres the portion of code they are talking about - can anyone make sense of it?



// Supporting functions
function NewsScroller_RenderChildren()
{
var sControlID = this.renderedControl;
elmControl = document.getElementById(sControlID);

// <DIV>
elmDiv = document.createElement("div");
elmDiv.style.position = "absolute";
elmDiv.style.left = "0px";
elmDiv.style.width = "100%";
elmDiv.style.height = "100%";
elmDiv.style.overflow = "hidden";
elmControl.appendChild(elmDiv);

for (var nItem = 0; nItem < this.itemCount; nItem++)
{
var sItemName = sControlID + nItem.toString();

var elmP = document.createElement("p");
elmP.id = sItemName;
elmP.style.position = "relative";
elmP.style.top = "0px";
elmP.style.width = "100%";
elmP.className = this.itemNormalClassName;
elmDiv.appendChild(elmP);

var elmA = document.createElement("a");
elmA.className = this.itemNormalClassName;
elmA.href = this.itemsLink[nItem];
elmP.appendChild(elmA);

var tn = document.createTextNode(this.itemsText[nItem]);
elmA.appendChild(tn);

}
}

Kor
04-21-2005, 12:43 PM
...
var tn = document.createTextNode(this.itemsText[nItem]);
elmA.appendChild(tn);
var oHr = document.createElement('hr');
elmA.appendChild(oHr);
}
}

fidgen
04-21-2005, 01:04 PM
thank you

:)

Kor
04-21-2005, 03:11 PM
following the pattern you may create&append whichever element you want. See also DOM methods.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum