Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

displaying the list items in a ticker

Status
Not open for further replies.

cfdeveloper

Programmer
Nov 20, 2003
144
0
0
GB
Hello Everybody,

I have a comma separated list. I want to display the list item(s) one after the other something like a ticker, starting from list position one to the length of the list. Can someone please show me how to do this? Or atleast if someone point me to some link which has a similar kind of thing, that would be very helpful.

Best Regards
CF Coder
 
I want the list Item to stay on the browser for atleast 5 seconds after which time, the next list item must show up replacing the exisitng one, so it should iterate continousley or randomly.
 
The idea behind is that I call a webservice which returns a comma separated list of items, I then display each item in a div or somewhere in the browser one after the other. I don't have a clue how to do this. I'd appreciate your help
 
I got this code from the archives

<HTML><HEAD><META HTTP-EQUIV=&quot;REFRESH&quot; CONTENT=&quot;2&quot;><TITLE>Monitor</TITLE></HEAD>
<BODY bgcolor=&quot;#FFFFFF&quot; background=&quot;&quot;>
<CFSET TheList = &quot;#lName#&quot;>
<TABLE>
<TR>
<br>
<CFLOOP FROM=&quot;1&quot; TO=&quot;1&quot; STEP=&quot;1&quot; INDEX=&quot;temp&quot;>
<CFSET Position = RandRange(1,ListLen(TheList))>
<TD><CFOUTPUT>#ListGetAt(TheList,Position)# </CFOUTPUT></TD>
<CFSET TheList = ListDeleteAt(TheList,Position)>
</CFLOOP>
</TR>
</TABLE>
</BODY>
</HTML>

When displayed on the page, the page refreshes every 2 seconds and randomly displays the list item. How do I make sure that all the items in the list are displayed, only repeating a list item once after all list items are displayed. how do I do that check?
 
First thing that comes to mind is a session variable to keep track of which was the last ticker item to be displayed. That will persist through browser refreshes (if cookies are turned on, etc) then you can just delete the session var when you leave the page, logout, or whatever.

Does that help?

MG
 
This code loops through an array. You could probably figure out how to list the array contents only once.

<CODE>
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>

<html>
<head>
<title>Untitled</title>
</head>

<body>
<style type=&quot;text/css&quot;>
#Spidey{
font-weight:bold;
font-style:italic;
color:green;
}
#Kaxgaroth{
font-weight:bold;
color:blue;
}
#EvilBert{
font-weight:bold;
font-style:italic;
color:#c00;
}
#banner{
position:absolute;/*for NN4*/
}
</style>

<script type=&quot;text/javascript&quot; language=&quot;Javascript1.2&quot;>
<!--

var ar = new Array();
ar[0] = &quot;<span id='Spidey'>Spidey</span>&quot;;
ar[1] = &quot;<span id='Kaxgaroth'>Kaxgaroth</span>&quot;;
ar[2] = &quot;<span id='EvilBert'>EvilBert</span>&quot;;

var num = 0;

window.onload=function (e) {
setInterval(&quot;update()&quot;, 5000);
}

function update() {
display(&quot;banner&quot;, ar[num]);
num++;
if (num == ar.length) num = 0;
}

function display(id, str) {
if (document.layers) {
with (document[id].document) {
open();
write(str);
close();
}
} else if(document.all) { document.all[id].innerHTML = str;
} else if(document.getElementById) { document.getElementById(id).innerHTML=str;
}
}

// -->
</script>
<div id=&quot;banner&quot;></div>


</body>
</html>

</CODE>

Phil Hegedusich
Senior Web Developer
IIMAK
-----------
Boy howdy, my Liberal Studies degree really prepared me for this....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top