javanovice2
12-18-2010, 09:47 AM
Hi all,
I have a free script I have downloaded and I can't figure out how to edit it so that I can change the color of the text to whatever I want it to be and also so that the length of the scrolling text (I am not sure if scrolling is the right term) can be changed.
For some reason the text does not go all the way to the end of the page on the right it stops quite a way before.
Here is the code:
<script language="JavaScript1.2">
<!--
/*
Typing Scroller
For full source code, usage terms, and 100s more scripts, visit http://dynamicdrive.com
*/
//Secify scroller contents
var line=new Array()
line[1]="Testing testing one to three and you can test some more."
line[2]="Always testing always testing"
line[3]="Trying to test some more and some more again"
line[4]="second to last bit of testing."
line[5]="Testing text that is just testing one more time"
//Specify font size for scoller
var ts_fontsize="13px"
//--Don't edit below this line
var longestmessage=1
for (i=2;i<line.length;i++){
if (line[i].length>line[longestmessage].length)
longestmessage=i
}
//Auto set scroller width
var tscroller_width=line[longestmessage].length
lines=line.length-1 //--Number of lines
//if IE 4+ or NS6
if (document.all||document.getElementById){
document.write('<form name="bannerform">')
document.write('<input type="text" name="banner" size="'+tscroller_width+'"')
document.write(' style="background-color: '+document.bgColor+'; color: '+document.body.text+'; font-family: arial; font-size: '+ts_fontsize+'; font-weight:bold; border: medium none" onfocus="blur()">')
document.write('</form>')
}
temp=""
nextchar=-1;
nextline=1;
cursor=""
function animate(){
if (temp==line[nextline] & temp.length==line[nextline].length & nextline!=lines){
nextline++;
nextchar=-1;
document.bannerform.banner.value=temp;
temp="";
setTimeout("nextstep()",1000)}
else if (nextline==lines & temp==line[nextline] & temp.length==line[nextline].length){
nextline=1;
nextchar=-1;
document.bannerform.banner.value=temp;
temp="";
setTimeout("nextstep()",1000)}
else{
nextstep()}}
function nextstep(){
if (cursor==""){
cursor=""}
else if (cursor==""){
cursor=""}
else if (cursor==""){
cursor=""}
else if (cursor==""){
cursor=""}
nextchar++;
temp+=line[nextline].charAt(nextchar);
document.bannerform.banner.value=temp+cursor
setTimeout("animate()",25)}
//if IE 4+ or NS6
if (document.all||document.getElementById)
window.onload=animate
// -->
</script>
I have been trying to figure this out for about 2 hours but since I am a 100% novice with javascript I have not got very far.
Any help would be gratefully recieved. :)
I have a free script I have downloaded and I can't figure out how to edit it so that I can change the color of the text to whatever I want it to be and also so that the length of the scrolling text (I am not sure if scrolling is the right term) can be changed.
For some reason the text does not go all the way to the end of the page on the right it stops quite a way before.
Here is the code:
<script language="JavaScript1.2">
<!--
/*
Typing Scroller
For full source code, usage terms, and 100s more scripts, visit http://dynamicdrive.com
*/
//Secify scroller contents
var line=new Array()
line[1]="Testing testing one to three and you can test some more."
line[2]="Always testing always testing"
line[3]="Trying to test some more and some more again"
line[4]="second to last bit of testing."
line[5]="Testing text that is just testing one more time"
//Specify font size for scoller
var ts_fontsize="13px"
//--Don't edit below this line
var longestmessage=1
for (i=2;i<line.length;i++){
if (line[i].length>line[longestmessage].length)
longestmessage=i
}
//Auto set scroller width
var tscroller_width=line[longestmessage].length
lines=line.length-1 //--Number of lines
//if IE 4+ or NS6
if (document.all||document.getElementById){
document.write('<form name="bannerform">')
document.write('<input type="text" name="banner" size="'+tscroller_width+'"')
document.write(' style="background-color: '+document.bgColor+'; color: '+document.body.text+'; font-family: arial; font-size: '+ts_fontsize+'; font-weight:bold; border: medium none" onfocus="blur()">')
document.write('</form>')
}
temp=""
nextchar=-1;
nextline=1;
cursor=""
function animate(){
if (temp==line[nextline] & temp.length==line[nextline].length & nextline!=lines){
nextline++;
nextchar=-1;
document.bannerform.banner.value=temp;
temp="";
setTimeout("nextstep()",1000)}
else if (nextline==lines & temp==line[nextline] & temp.length==line[nextline].length){
nextline=1;
nextchar=-1;
document.bannerform.banner.value=temp;
temp="";
setTimeout("nextstep()",1000)}
else{
nextstep()}}
function nextstep(){
if (cursor==""){
cursor=""}
else if (cursor==""){
cursor=""}
else if (cursor==""){
cursor=""}
else if (cursor==""){
cursor=""}
nextchar++;
temp+=line[nextline].charAt(nextchar);
document.bannerform.banner.value=temp+cursor
setTimeout("animate()",25)}
//if IE 4+ or NS6
if (document.all||document.getElementById)
window.onload=animate
// -->
</script>
I have been trying to figure this out for about 2 hours but since I am a 100% novice with javascript I have not got very far.
Any help would be gratefully recieved. :)