Code Bank
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingCode Bank

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
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  
Old February 12th, 2004, 03:19 PM
ricksterval's Avatar
ricksterval ricksterval is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 31 ricksterval User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
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

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingCode Bank > Display a dynamic Ticker Tape


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway