/    Sign up×
Community /Pin to ProfileBookmark

js message scroller

hello,

i have a message scroller that displays 3 news headings, however only the 1st heading is showing and i get an undefined from the other 2. below is the code. thanks.

<SCRIPT LANGUAGE=”JavaScript”>

<!– Begin
//slider’s width
var swidth=150

//slider’s height
var sheight=160

//slider’s speed
var sspeed=1

//messages: change to your own; use as many as you’d like; set up Hyperlinks to URLs as you normally do: <a target=… href=”… URL …”>..message..</a>
var singletext=new Array()
singletext[0]='<div align=”center”><font face=Verdana size=1 color=”#1A0980″><b>Monday, April 25, 2005 </b><br><br>PTS welcomes new employee, <b>Dan McHugh</b>, who joins us as an experienced Project Engineer, formerly with Beach Electric and Railroad Construction Corporation. Dan will bring his many years of project experience to bear as he expands the capabilities of PTSs consulting, design and project management Services… </div></FONT>’

//singletext[1]='<div align=”center”><font face=Arial size=3 color=”white”>Use this for announcements<br>or even <font color=”#1A0980″><b><i>images</i></b><p></font></div>’
//singletext[2]='<div align=”center”><font face=Arial size=3 color=”white”>This is great!<br>You can use <i>all</i> the <b>basic</b><br><b>HTML codes</b></font></div>’
//singletext[3]='<div align=”center”><font face=Arial size=3 color=”white”><b>JavaScript Source</b><br>A “cut & paste” JavaScript library<br>with <font color=”red”><b>tons</b></font> of free JavaScripts!<p></font></div>’
if (singletext.length>1)
i=1
else
i=0
function start(){
if (document.all){
ieslider1.style.top=sheight
iemarquee(ieslider1)
}
else if (document.layers){
document.ns4slider.document.ns4slider1.top=sheight
document.ns4slider.document.ns4slider1.visibility=’show’
ns4marquee(document.ns4slider.document.ns4slider1)
}
else if (document.getElementById&&!document.all){
document.getElementById(‘ns6slider1’).style.top=sheight
ns6marquee(document.getElementById(‘ns6slider1’))
}
}
function iemarquee(whichdiv){
iediv=eval(whichdiv)
if (iediv.style.pixelTop>0&&iediv.style.pixelTop<=sspeed){
iediv.style.pixelTop=0
setTimeout(“iemarquee(iediv)”,100)
}
if (iediv.style.pixelTop>=sheight*-1){
iediv.style.pixelTop-=sspeed
setTimeout(“iemarquee(iediv)”,100)
}
else{
iediv.style.pixelTop=sheight
iediv.innerHTML=singletext[i]
if (i==singletext.length-1)
i=0
else
i++
}
}
function ns4marquee(whichlayer){
ns4layer=eval(whichlayer)
if (ns4layer.top>0&&ns4layer.top<=sspeed){
ns4layer.top=0
setTimeout(“ns4marquee(ns4layer)”,100)
}
if (ns4layer.top>=sheight
*
-1){
ns4layer.top-=sspeed
setTimeout(“ns4marquee(ns4layer)”,100)
}
else{
ns4layer.top=sheight
ns4layer.document.write(singletext[i])
ns4layer.document.close()
if (i==singletext.length-1)
i=0
else
i++
}
}
function ns6marquee(whichdiv){
ns6div=eval(whichdiv)
if (parseInt(ns6div.style.top)>0&&parseInt(ns6div.style.top)<=sspeed){
ns6div.style.top=0
setTimeout(“ns6marquee(ns6div)”,100)
}
if (parseInt(ns6div.style.top)>=sheight*-1){
ns6div.style.top=parseInt(ns6div.style.top)-sspeed
setTimeout(“ns6marquee(ns6div)”,100)
}
else{
ns6div.style.top=sheight
ns6div.innerHTML=singletext[i]
if (i==singletext.length-1)
i=0
else
i++
}
}
// End –>
</script>

<BODY onLoad=”start()”>

<TABLE border=2 bordercolor=”#1A0980″ style=”border-collapse: collapse; ” >
<TR>
<TD height=”30″ align=”center” bgcolor=”#1A0980″ title=”Data Center, Server Room, Computer Room”><A HREF=”news.asp”><font size=”2″ color=”white”><b>IN THE NEWS…</b></font></A></TD>
</TR>
<TR>
<TD>

<ilayer id=”ns4slider” width=”&{swidth};” height=”&{sheight};”>
<layer id=”ns4slider1″ height=”&{sheight};” onmouseover=”sspeed=0;” onmouseout=”sspeed=2″>
<script language=”JavaScript”>
if (document.layers)
document.write(singletext[0])
</script>
</layer></ilayer>
<script language=”JavaScript”>
if (document.all){
document.writeln(‘<div style=”position:relative;overflow:hidden;width:’+swidth+’;height:’+sheight+’;clip:rect(0 ‘+swidth+’ ‘+sheight+’ 0);border:0 solid #1A0980;” onmouseover=”sspeed=0;” onmouseout=”sspeed=2″>’)
document.writeln(‘<div id=”ieslider1″ style=”position:relative;width:’+swidth+’;”>’)
document.write(singletext[0])
document.writeln(‘</div></div>’)
}
if(document.getElementById&&!document.all){
document.writeln(‘<div style=”position:relative;overflow:hidden;width:’+swidth+’;height:’+sheight+’;clip:rect(0 ‘+swidth+’ ‘+sheight+’ 0);border:0 solid #1A0980;” onmouseover=”sspeed=0;” onmouseout=”sspeed=2″>’)
document.writeln(‘<div id=”ns6slider1″ style=”position:relative;width:’+swidth+’;”>’)
document.write(singletext[0])
document.writeln(‘</div></div>’)

}
</script>

</TD>
</TR>

</TABLE>

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@A1ien51May 06.2005 — they are commented out...remove the comments on the arrays!
Copy linkTweet thisAlerts:
@jmaresca2005authorMay 06.2005 — i used the comments to attempt to get rid of the undefined error i get. the comment didnt make a difference. It may be the placement on my web page, when i use the code in a blank html file it works fine. when i incorporate it into the look and feel of the site i get the undefined.
×

Success!

Help @jmaresca2005 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...