Scrolling text from external file

Posted on 2007-11-23
Last Modified: 2013-12-25
I need a scrolling text that will load the text  from a text file (.txt), so that the users will be able to change the text regularly. Maybe with an option of having some of the text link to another page. Thanks
Question by:cenweb
  • 3
  • 2
LVL 17

Accepted Solution

gops1 earned 125 total points
ID: 20339209
A small demonstration with Ajax. Designed to run locally. Please do a further study to adapt to your environment. Here is the code:

		<title>Script Demo Gops</title>
		<script language="javascript">
			function ajaxpage(url, containerid){
				var page_request = false
				if (window.XMLHttpRequest) // if Mozilla, Safari etc
					  page_request = new XMLHttpRequest()
				else if (window.ActiveXObject){ // if IE
					  try {
							page_request = new ActiveXObject("Msxml2.XMLHTTP")
					  }catch (e){
								  page_request = new ActiveXObject("Microsoft.XMLHTTP")
							}catch (e){}
				} else return false
					  loadpage(page_request, containerid)
				}'GET', url, true)
			function loadpage(page_request, containerid){
				if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
				ajaxpage('marque.txt', 'mar');
	<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">
		<marquee style="position:absolute;left:100px;margin-top:100px;background-color:grey;width:200px;height:15px;font-family:verdana;font-size:11px;" scrolldelay="1000" id="mar">aaaa</marquee>

Open in new window


Author Comment

ID: 20339255

UI take it "'marque.txt" is the external text file. Can you please give me what the content of the text file will look like. Thanks

LVL 17

Expert Comment

ID: 20339398
You can type anything. Here is what I have:
"This would be so slow, you'd get no sense of animation."

Author Comment

ID: 20339552
Sorry I think I'm missing something. the content of my marque.txt file is not displayed, but the text typed between the <marque > tags.
LVL 17

Expert Comment

ID: 20340054
where have you placed the file? Is it in the same directory?

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
This article will show, step by step, how to integrate R code into a R Sweave document
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…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

770 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