Solved

Scrolling text from external file

Posted on 2007-11-23
6
507 Views
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
0
Comment
Question by:cenweb
[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
  • 3
  • 2
6 Comments
 
LVL 17

Accepted Solution

by:
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:

<html>
	<head>
		<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){
							try{
								  page_request = new ActiveXObject("Microsoft.XMLHTTP")
							}catch (e){}
					  }
				} else return false
 
 
				page_request.onreadystatechange=function(){
					  loadpage(page_request, containerid)
				}
 
				page_request.open('GET', url, true)
				page_request.send(null)
			}
 
			function loadpage(page_request, containerid){
				if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
				document.getElementById(containerid).innerHTML=page_request.responseText
			}
 
			window.onload=function(){
				ajaxpage('marque.txt', 'mar');
			}
		</script>
	</head>
	<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>
	</body>
</html>

Open in new window

0
 

Author Comment

by:cenweb
ID: 20339255
Thanks

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

0
 
LVL 17

Expert Comment

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

Author Comment

by:cenweb
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.
0
 
LVL 17

Expert Comment

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

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
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.
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

635 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