...

View Full Version : scrolling marquee based on a .txt file



Snitz
08-02-2006, 09:09 PM
I'm looking for a code like these news tickers you see on TVS nowadays at the bottom of the screen, where they show you the latest headlines.

I want a simple scrolling marquee text that shows the text based on a txt file
with the ability to insert an image between every line

Kravvitz
08-02-2006, 09:24 PM
You shouldn't use scrolling text on a web page for accessibility reasons.

http://www.w3.org/TR/WAI-WEBCONTENT/#q33
http://www.google.com/search?q=accessibility+marquee

If you must have scrolling text, you should provide a method to stop the scrolling.

felgall
08-03-2006, 09:41 PM
Javascript can't read files so you will either have to convert the text file content into Javascript or set up server side processing to read the file and conert it to Javascript.

vwphillips
08-03-2006, 10:33 PM
bit rough


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>
<title></title>
</head>

<body>
<script language="JavaScript" type="text/javascript">
<!--
var TO;

function Scroll(){

var inner=document.getElementById('outerDisplay');
if (parseInt(inner.style.left)>-parseInt(inner.style.width)){
inner.style.left=(parseInt(inner.style.left)-1)+'px';
TO=setTimeout('Scroll()',100);
}
else {
inner.style.left=(0)+'px';
Scroll();
}
}
var srcFrame;
//External content into a layer
function loadOuter(doc) {
srcFrame = document.getElementById("hiddenContent");
srcFrame.src = doc;
// workaround for missing onLoad event in IFRAME for NN6
if (!srcFrame.onload) {
setTimeout("transferHTML()", 1000)
}
}

function transferHTML(){
srcContent='';
if (srcFrame.contentDocument){
srcContent=srcFrame.contentDocument.getElementsByTagName("BODY")[0].innerHTML;
}
else if (srcFrame.contentWindow){
srcContent=srcFrame.contentWindow.document.body.innerHTML;
}
document.getElementById("outerDisplay").innerHTML = srcContent;
clearTimeout(TO);
Scroll();
}


var DocAry=new Array('Test.txt','Test2.txt');

function SelectList(v){
if (v>0){
loadOuter(DocAry[v-1]);
}
}

//-->
</script>


<INPUT TYPE="button" VALUE="Test2.txt" onClick="loadOuter('Test2.txt')" >
<br>



<div style="position:relative;overflow:hidden;width:100px;height:40px;" >
<div id="outerDisplay" style=position:absolute;left:0px;top:0px;width:300px;>1 2 3 4 5 </div>
</div>

<iframe id="hiddenContent" width="200" height="200" style="position:absolute;visibility:hidden;" ></iframe>

</body>

</html>


Test2.txt


Item 11 Item 12 Item 13 Item 14 Item 15 Item 16 Item 17

tiagolr
07-13-2010, 09:43 PM
Is it possible scroll up? and take out the button?

tks



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum