Solved

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

Posted on 2001-06-02
4
209 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Handling case and special names in javascript 3 48
modify change color of text 9 48
Horizontal Full Calendar using php 5 39
Slow Down an Animation 3 27
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

739 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