Click to See Complete Forum and Search --> : please help debug


esthera
12-15-2003, 02:27 AM
The following is my code which is on http://www.nevey.org.
I believe someone from this forum helped me with some of it.
The problem is that on some computers (not browser related as it was tested on many computers and the problem occured on different browsers) the text breaks in the middle and the work more is printed twice. Does anyone know what I can do to fix this. Is their an alternative way to do this code.

Here's the code:

// news ticker function
itemNum = 0
newsList = new Array()

newsList[0]=new Array(' Moreshet Institute Mid-Winter Kiruv Training Seminar in Israel, Jan. 18 - 25. Register now.','http://www.nevey.org/moreshetad.htm')
newsList[1]=new Array(' During the period from December 2nd through December 4th, no e-mails were received by Neve in Israel due to a technical malfunction. If you sent an e-mail during this period, please resend. Thank you. ','')

function newsTicker(){
window.newsItem = newsList[itemNum][0]
window.tdNode = document.getElementById("mtxt")
window.currLetter = 0
tdNode.innerHTML = ""
if (newsList[itemNum][1] == ""){
window.moreLink = ""
}
else{
window.moreLink = " &nbsp;&nbsp;&nbsp; <a href='" + newsList[itemNum][1] + "' class=hptextylink>More >> </a>"
}
addLetters()
itemNum < newsList.length-1 ? itemNum ++ : itemNum = 0
setTimeout("newsTicker()",10000)
//above makes the headlines stay longer
}

function addLetters(){
if (currLetter < newsItem.length){
//alert(newsItem.chatAt(0))
tdNode.innerHTML += newsItem.charAt(currLetter)
currLetter ++
adding = setTimeout("addLetters()",30)
//the higher the above number makes the letters appear slower
}
else{
tdNode.innerHTML += moreLink
clearTimeout(adding)
}

}

fredmv
12-15-2003, 03:41 AM
Do you have the HTML you used as well? Maybe the width of the element the text was contained in was too small and as a result creating a line-break in the text when the width of the element was reached.

esthera
12-15-2003, 03:51 AM
<td width="100" valign="top" class="hptextylink">Neve News:</td>
<td class=hptextwhite id=mtxt valign=top height=50></td>

I made it bigger and it didn't make a difference.

fredmv
12-15-2003, 03:57 AM
Try using this instead:<div style="float: left;">Neve News:&amp;nbsp;</div>
<div id="mtxt" class="hptextwhite" style="height: 50px; width: 100%"></div>

esthera
12-15-2003, 04:37 AM
I tried it but it's still the same problem.