Jump to content

i need some help with javascript


nightsider

Recommended Posts

hi all, I'm trying to make a web page and part of the content is a scrolling list, as i don't know javascript at all Ive had to customize a free script.

 

my problem is that i cant change the color of the text in the list, and as a result it blends into the page background and is unreadable.

 

can some one please hep me to change the color of the scrolling list please.

 

<style type="text/css">
<!--
#Layer1 {
position:left;

}
-->
</style>


<center>
</center>



<script type="text/javascript">
var charIndex = -1;
var stringLength = 0;
var inputText;
function writeContent(init){
	if(init){
		inputText = document.getElementById('contentToWrite').innerHTM  L;
	}
	if(charIndex==-1){
		charIndex = 0;
		stringLength = inputText.length;
	}
	var initString = document.getElementById('myContent').innerHTML;
	initString = initString.replace(/<SPAN.*$/gi,"");

	var theChar = inputText.charAt(charIndex);
	   var nextFourChars = inputText.substr(charIndex,4);
	   if(nextFourChars=='<BR>' || nextFourChars=='<br>'){
		   theChar  = '<BR>';
		   charIndex+=3;
	   }
	initString = initString + theChar + "<SPAN id='blink'>_</SPAN>";
	document.getElementById('myContent').innerHTML = initString;

	charIndex = charIndex/1 +1;
	if(charIndex%2==1){
		 document.getElementById('blink').style.display='no  ne';
	}else{
		 document.getElementById('blink').style.display='in  line';
	}

	if(charIndex<=stringLength){
		setTimeout('writeContent(false)',90);
	}else{
		blinkSpan();
	}
}

var currentStyle = 'inline';
function blinkSpan(){
	if(currentStyle=='inline'){
		currentStyle='none';
	}else{
		currentStyle='inline';
	}
	document.getElementById('blink').style.display = currentStyle;
	setTimeout('blinkSpan()',300);

}


msg = "test";

msg = " " + msg;pos = 0;
function scrollMSG() {
document.title = msg.substring(pos, msg.length) + msg.substring(0, pos);
pos++;
if (pos >  msg.length) pos = 0
window.setTimeout("scrollMSG()",200);
}
scrollMSG();
</script>
<center>
<table width="572" height="215">
<tr>
<td width="364">
<div id="myContent" class="tip">
</div>
<div id="contentToWrite" style="display:none" text-decoration:"overline" class="tip">

<br />text 1
<br>
<br /> text 2
<br>
<br /> text 3
<br>
<br /> text 4
<br>
<br />  text 5
<br>
<br /> text 6
<br>
<br />  text 7
<br>
<br /> text 8
<br>
<br />  text 9
<br>
<br />  text 10
<br>
<br />  text 11
<br>
<br /> text 12
<br>
<br /> text 13
<br>
<br /> text 14






</div>

</td>
</tr>
</table>


<table class="listing">
<tr>

<td class="listing">

</td>

</tr>
</table>
<p>   </p>
<p>
 <script type="text/javascript">
writeContent(true);
 </script>
</p>
</center>

Share this post


Link to post
Share on other sites

<html>
<head>
<script type="text/javascript">
var charIndex = -1;
var stringLength = 0;
var inputText;

function writeContent(init){
if(init){
	inputText = document.getElementById('contentToWrite').innerHTML;
}
if(charIndex==-1){
	charIndex = 0;
	stringLength = inputText.length;
}

var initString = document.getElementById('myContent').innerHTML;

initString = initString.replace(/<SPAN.*$/gi,"");

var theChar = inputText.charAt(charIndex);
var nextFourChars = inputText.substr(charIndex,4);
if(nextFourChars=='<br />' || nextFourChars=='<br>'){
	theChar  = '<br />';
	charIndex+=3;
}

initString = initString + theChar + "<SPAN id='blink'>_</SPAN>";
document.getElementById('myContent').innerHTML = initString;

charIndex = charIndex/1 +1;

if(charIndex%2==1){
	document.getElementById('blink').style.display='none';
}else{
	document.getElementById('blink').style.display='inline';
}

if(charIndex<=stringLength){
	setTimeout('writeContent(false)',90);
}else{
	blinkSpan();
}
}

var currentStyle = 'inline';

function blinkSpan(){
if(currentStyle=='inline'){
	currentStyle='none';
}else{
	currentStyle='inline';
}

document.getElementById('blink').style.display = currentStyle;
setTimeout('blinkSpan()',300);
}

msg = "test";

msg = " " + msg;pos = 0;

function scrollMSG() {
document.title = msg.substring(pos, msg.length) + msg.substring(0, pos);
pos++;
if (pos >  msg.length) pos = 0
window.setTimeout("scrollMSG()",200);
}
scrollMSG();
</script>
</head>

<body onload="writeContent(true);">
<center>
<table width="572" height="215">
<tr>
<td width="364">
<div id="myContent" class="tip">
</div>

<div id="contentToWrite" style="display:none;" class="tip">
<br />text 1
<br />
<br />text 2
<br />
<br />text 3
<br />
<br />text 4
<br />
<br />text 5
<br />
<br />text 6
<br />
<br />text 7
<br />
<br />text 8
<br />
<br />text 9
<br />
<br />text 10
<br />
<br />text 11
<br />
<br />text 12
<br />
<br />text 13
<br />
<br />text 14
</div>
</td>
</tr>
</table>

<table class="listing">
<tr>
<td class="listing">
</td>
</tr>
</table>
</center>
</body>
</html>

Share this post


Link to post
Share on other sites

i dident wright the code im having to customize a free script as i dont know JS

My point being that you don't even need javascript if all you want to do is scroll text unless you're customizing the actual scrollbar.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...