Solved

How do I create a scrolling banner using text from an external txt file?

Posted on 2001-06-02
4
198 Views
Last Modified: 2008-03-06
I am trying to create a scrolling banner containing recient news on my website. because i will need to up date it regularly i want to be able to send a txt file to my webspace which the banner on the page will take text from.
0
Comment
Question by:andichilds
  • 4
4 Comments
 
LVL 5

Expert Comment

by:djbusychild
ID: 6149051
there are many scrolling text scripts around the net:

http://www.j-scripts.com/scripts/script045.asp
http://www.widomaker.com/~reboughner/W3C/scrollbanner/scroll.html

to be able to use a text file that's on the server you would need to use serverside script. If you cannot afford to use a serverside script to populate the content, then you can get by by using either an applet:

http://javaboutique.internet.com/ZeBanner/

or an html file instead of a plain ol' text file for your banner content.

0
 
LVL 5

Expert Comment

by:djbusychild
ID: 6149057
tell me if you need an example of how to do that. If you don't want to complicate manners, than applet is the easy way to go.
0
 
LVL 5

Expert Comment

by:djbusychild
ID: 6149087
the scrolling part is very simple, the loading news from external file cross-browser is the chunk of the code..

your banner file will look like this:

<form method="get" action="#">
<textarea name="bannersrc">
news1
news2
news3
news4
</textarea>
</form>

------------------------------
the page you will have will be like this
------------------------------

<html>
<head>

<script>
doc=document;
IE=(doc.all)?1:0;
delim=/\r*\n/g; /* this is the delimiter for your news */
spacer=" --- "; /* this is how it'll be delimited on screen */
box=null;
speed=300;
full_banner_text="";

function scrollBanner(){
 theText=box.value;
 box.value=theText.substring(1)+theText.substring(0,1);
}

function setBanner(box,str){
 var news_list=str.replace(delim,spacer);
 box.value=news_list;

}

function loadBannerText(){
 var src=(IE)?doc.frames["bannerSrc"]:doc.layers["bannerSrc"];
 return src.document.forms[0]["bannersrc"].value;
}

window.onload=function() {
 box=doc.forms["bannerForm"]["bannerBox"]
 full_banner_text=loadBannerText();
 setBanner(box,full_banner_text);
 window.setInterval("scrollBanner()",100);
}

</script>

</head>
<body>

<iframe id="bannerSrc" frameborder="0" width="0" height="0" src="mybanner.htm"></iframe>
<layer visibility="hide" width="0" height="0" left="0" top="0" id="bannerSrc" src=mybanner.htm></layer>

<div align="center">

<form name="bannerForm" method="get" action="#">
<input name="bannerBox" type="text" size="40" style="width:300px;"><br />
</form>

</div>


</body>
</html>
0
 
LVL 5

Accepted Solution

by:
djbusychild earned 300 total points
ID: 6149090
I stole one of the scrolling code from one of the URL. =)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now