| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
||||
|
||||
|
Display a dynamic Ticker Tape
<%
'Created by Max Cappellari 'to get the content from a Database: 'simply create a Recordset object here. Link1 = "<a href='http://www.yahoo.com'>http://www.yahoo.com</a>" Link2 = "<a href='http://www.cnn.com'>http://www.cnn.com</a>" Link3 = "<a href='http://www.aol.com'>http://www.aol.com</a>" 'Settings TickerColor = "#9CD3FF" TickerHeight = 15 TickerWidth = 300 %> <style> <!-- #tickertape { position:relative; layer-background-color:<%=TickerColor%>; width:<%=Tickerwidth%>; height:<%=TickerHeight%>; } #subtickertape{ background-color:<%=TickerColor%>; position:absolute; border: 0px <%=TickerColor%> width:<%=Tickerwidth%>; height:<%=TickerHeight%>; } .subtickertapefont { font: 12px underlined Verdana; text-decoration:none; color:black; } .subtickertapefont a { color:black; text-decoration:none; } --> </style> <script language="JavaScript"> function regenerate() { window.location.reload() } function regenerate2() { if (document.layers) setTimeout("window.onresize = regenerate",450) } function update() { if (document.layers){ document.tickertape.document.subtickertape.documen t.write ('<span class="subtickertapefont">'+news[i]+'</span>') document.tickertape.document.subtickertape.documen t.close() } else { document.all.subtickertape.innerHTML=news[i] } if (i<news.length-1) i++ else i=0 setTimeout("update()",speed) } </script> <%' To get the content from a database, Loop through the recordset here %> <form name="tform" id="tform"> <input type=hidden name="link1" value="<%=Link1%>"> <input type=hidden name="link2" value="<%=Link2%>"> <input type=hidden name="link3" value="<%=Link3%>"> </form> <% 'end of loop %> <script language="Javascript"> //default speed is 4.5 seconds var speed = 4500 var news = new Array() news[0] = document.forms["tform"].item("link1").value news[1] = document.forms["tform"].item("link2").value news[2] = document.forms["tform"].item("link3").value i = 0 </script> <table border=0 bgcolor="<%=TickerColor%>" cellpadding=0 cellspacing=0 width=<%=TickerWidth%>> <tr bgcolor="<%=TickerColor%>" height=<%=TickerHeight%>> <td bgcolor="<%=TickerColor%>"> <div id="tickertape"> <div id="subtickertape" class="subtickertapefont">Initializing...</div> </div> </td> </tr> </table> <!-- end of file--> Then in the Main file just add the following in the Tag: <BODY Onload = "if (document.all||document.layers){regenerate2();upda te()}"> <!--#include File="TickerInclude.asp"--> Read Complete Article |
![]() |
| Viewing: ASP Free Forums > Programming > Code Bank > Display a dynamic Ticker Tape |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|