PDA

View Full Version : Text Animator won't work in Firefox



craigt
06-30-2010, 05:20 PM
Can anyone get the following script to behave in Firefox:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<STYLE type="text/css">.textanimlink {
TEXT-DECORATION: none
}
A {
TEXT-DECORATION: none
}
P.main {
FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial
}
</STYLE>
<SCRIPT language=Javascript 1.2>
<!-- Hiding

/*
Script created by Lefteris Haritou
(lef@the.forthnet.gr)
Permission granted to Dynamicdrive.com to feature the script
For more DHTML scripts, visit Dynamicdrive.com
*/

bname=navigator.appName;
bversion=parseInt(navigator.appVersion)
if ((bname=="Netscape" && bversion>=4) || (bname=="Microsoft Internet Explorer" && bversion>=4))
window.onload=start
else
stop();
window.onunload=stop
if (bname=="Netscape"){
brows=true
dt=2
}
else{
brows=false
dt=20
}
var z=0;
var msg=0;
var rgb=0;
var link=false;
var status=true;
var updwn=false;
var message= new Array();
var value=0;
var h=window.innerHeight;
var w=window.innerWidth;
var timer1;
var timer2;
var timer3;
var convert = new Array()
var hexbase= new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F");

// Put here your own messages. Add as many as you wan't (Do not edit anything else in the Script except the lines below)

var bgcolor="#00ccff"; //Color of background
var color="#00008D"; //Color of the Letters

message[0]='Soft Touch Computer Services'
message[1]='Is the Future of Training'
message[2]='Today.'


// Put here your own messages. Add as many as you wan't (Do not edit anything else in the Script except the lines above)

for (x=0; x<16; x++){
for (y=0; y<16; y++){
convert[value]= hexbase[x] + hexbase[y];
value++;
}
}

redx=color.substring(1,3);
greenx=color.substring(3,5);
bluex=color.substring(5,7);
hred=eval(parseInt(redx,16));
hgreen=eval(parseInt(greenx,16));
hblue=eval(parseInt(bluex,16));
eredx=bgcolor.substring(1,3);
egreenx=bgcolor.substring(3,5);
ebluex=bgcolor.substring(5,7);
ered=eval(parseInt(eredx,16));
egreen=eval(parseInt(egreenx,16));
eblue=eval(parseInt(ebluex,16));
red=ered;
green=egreen;
blue=eblue;

function start(){
if ((bname=="Netscape" && bversion>=4) || (bname=="Microsoft Internet Explorer" && bversion>=4)){
link=false;
updwn=true;
if (brows)
res=document.layers['textanim'].top
else{
textanim.style.width=document.body.offsetWidth-20;
textanim.innerHTML='<Pre><P Class="main" Align="Center">'+message[msg]+'</P></Pre>'
res=textanim.style.top
for (x=0; x<document.all.length; x++)
if(document.all[x].id=="textanimlink")
link=true;
}
up()
}
}

function stop(){
clearTimeout(timer1);
clearTimeout(timer2);
clearTimeout(timer3);
}

function resz(){
h=window.innerHeight;
w=window.innerWidth;
if (updwn)
timer1=setTimeout('up()',1000)
else
timer2=setTimeout('down()',1000)
}

function breakf(){
if (status){
clearTimeout(timer1);
clearTimeout(timer2);
status=false
return;
}
else{
status=true;
if (updwn)
timer1=setTimeout('up()',dt)
else
timer2=setTimeout('down()',dt)
}
}


function up(){
if (red<hred){
if ((red+7)<hred)
red+=7;
else
red=hred
redx = convert[red]
}
else{
if ((red-7)>hred)
red-=7;
else
red=hred
redx = convert[red]
}

if (green<hgreen){
if ((green+7)<hgreen)
green+=7;
else
green=hgreen
greenx = convert[green]
}
else{
if ((green-7)>hgreen)
green-=7;
else
green=hgreen
greenx = convert[green]
}

if (blue<hblue){
if ((blue+7)<hblue)
blue+=7;
else
blue=hblue
bluex = convert[blue]
}
else{
if ((blue-7)>hblue)
blue-=7;
else
blue=hblue
bluex = convert[blue]
}

rgb = "#"+redx+greenx+bluex;
if (brows){
document.layers['textanim'].document.linkColor=rgb;
document.layers['textanim'].document.vlinkColor=rgb;
if (window.innerHeight!=h || window.innerWidth!=w){
clearTimeout(timer1);
resz()
return;
}
else{
document.layers['textanim'].document.write('<Pre><P Class="main" Align="Center"><font color="'+rgb+'">'+message[msg]+'</font></P></Pre>')
document.layers['textanim'].document.close();
}
}
else{
textanim.style.color=rgb;
if(link)
textanimlink.style.color=rgb;
}
if (z<38){
if (brows)
document.layers['textanim'].top--
else
textanim.style.posTop--
z++
timer1=setTimeout('up()',dt)
}
else
{
updwn=false;
down()
}
}


function down(){
if (red<ered){
if ((red+7)<ered)
red+=7;
else
red=ered
redx = convert[red]
}
else{
if ((red-7)>ered)
red-=7;
else
red=ered
redx = convert[red]
}

if (green<egreen){
if ((green+7)<egreen)
green+=7;
else
green=egreen
greenx = convert[green]
}
else{
if ((green-7)>egreen)
green-=7;
else
green=egreen
greenx = convert[green]
}

if (blue<eblue){
if ((blue+7)<eblue)
blue+=7;
else
blue=eblue
bluex = convert[blue]
}
else{
if ((blue-7)>eblue)
blue-=7;
else
blue=eblue
bluex = convert[blue]
}

rgb = "#"+redx+greenx+bluex;
if (brows){
document.layers['textanim'].document.linkColor=rgb;
document.layers['textanim'].document.vlinkColor=rgb;
if (window.innerHeight!=h || window.innerWidth!=w){
clearTimeout(timer2);
resz()
return;
}
else{
document.layers['textanim'].document.write('<Pre><P Class="main" Align="Center"><font color="'+rgb+'">'+message[msg]+'</font></P></Pre>')
document.layers['textanim'].document.close();
}
}
else{
textanim.style.color=rgb;
if(link)
textanimlink.style.color=rgb;
}

if (z<76){
if (brows)
document.layers['textanim'].top--
else
textanim.style.posTop--
z++
timer2=setTimeout('down()',dt)
}
else
{
if (brows){
document.layers['textanim'].document.write('')
document.layers['textanim'].document.close();
}
else
textanim.innerHTML='';
window.clearInterval(timer2);
if(msg<message.length-1){
msg++;
z=0;
if (brows){
document.layers['textanim'].top=res;
}
else
textanim.style.top=res;
timer3=setTimeout('start()',100);
}
else
{
msg=0;
z=0;
if (brows)
document.layers['textanim'].top=res;
else
textanim.style.top=res;
timer3=setTimeout('start()',2000);
}
}
}


// done hiding -->
</SCRIPT>
<LAYER top="440" left="0" name="textanim"></LAYER>
<META content="MSHTML 6.00.2800.1458" name=GENERATOR></HEAD>
<BODY background="blue blocks.jpg" bgcolor="00ccff">
<DIV id=textanim style="LEFT: 0px; POSITION: absolute; TOP: 200px"
onclick=breakf()></DIV></BODY></HTML>

Thanks in advance!

clueful
06-30-2010, 09:03 PM
Can anyone get the following script to behave in Firefox:Why don't you try emailing the author? My guess is he's vanished long ago as should his code.
That is an outdated and very poorly-written script that can be fixed only by completely rewriting it.

jscheuer1
07-01-2010, 02:31 AM
Ugly, but works and validates:


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>
<title></title>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<style type="text/css">
.textanimlink {
text-decoration: none
}
a {
text-decoration: none
}
p.main {
font-weight: bold; font-size: 10pt; font-family: arial
}
</style>
<script type="text/javascript">

/*
Script created by Lefteris Haritou
(lef@the.forthnet.gr)
Permission granted to Dynamicdrive.com to feature the script
For more DHTML scripts, visit Dynamicdrive.com
*/

if (document.getElementById)
(function(){

// Put here your own colors and messages. (Do not edit anything else in the Script except the lines below)

var bgcolor = "#00ccff"; //Color of background
var color = "#00008D"; //Color of the Letters

var message = []; //Add as many messages as you want
message[0]='Soft Touch Computer Services'
message[1]='Is the Future of Training'
message[2]='Today.'

// Stop Editing

if (window.addEventListener){
window.addEventListener('load', prestart, false);
window.addEventListener('unload', stop, false);
}
else if (window.attachEvent){
window.attachEvent('onload', prestart);
window.attachEvent('onunload', stop);
}
var dt = 20;
var z=0;
var msg=0;
var rgb=0;
var link=false;
var status=true;
var updwn=false;
var value=0;
var timer1;
var timer2;
var timer3;
var convert = [];
var hexbase = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'];

for (var x=0; x < 16; ++x){
for (var y=0; y < 16; ++y){
convert[value] = hexbase[x] + hexbase[y];
++value;
}
}

var redx=color.substring(1,3);
var greenx=color.substring(3,5);
var bluex=color.substring(5,7);
var hred=eval(parseInt(redx,16));
var hgreen=eval(parseInt(greenx,16));
var hblue=eval(parseInt(bluex,16));
var eredx=bgcolor.substring(1,3);
var egreenx=bgcolor.substring(3,5);
var ebluex=bgcolor.substring(5,7);
var ered=eval(parseInt(eredx,16));
var egreen=eval(parseInt(egreenx,16));
var eblue=eval(parseInt(ebluex,16));
var red=ered;
var green=egreen;
var blue=eblue;
var textanimtag, textanimstyle, textanimlinktag, res;

function prestart(){
textanimtag = document.getElementById('textanim');
textanimstyle = textanimtag.style;
textanimstyle.width = '100%';
textanimstyle.backgroundColor = bgcolor;
start();
}

function start(){
textanimlinktag = document.getElementById('textanimlink');
textanimtag.innerHTML = '<pre><p class="main" align="center">' + message[msg] + '<\/p><\/pre>'
res=parseInt(textanimstyle.top || 0);
if(textanimlinktag)
link=true;
up();
}

function stop(){
clearTimeout(timer1);
clearTimeout(timer2);
clearTimeout(timer3);
}

function breakf(){
if (status){
clearTimeout(timer1);
clearTimeout(timer2);
status = false;
return;
}
else{
status = true;
if (updwn)
timer1 = setTimeout(function(){up();}, dt)
else
timer2 = setTimeout(function(){down();}, dt)
}
}

window.breakf = breakf;

function up(){
if (red<hred){
if ((red+7)<hred)
red+=7;
else
red=hred
redx = convert[red]
}
else{
if ((red-7)>hred)
red-=7;
else
red=hred
redx = convert[red]
}

if (green<hgreen){
if ((green+7)<hgreen)
green+=7;
else
green=hgreen
greenx = convert[green]
}
else{
if ((green-7)>hgreen)
green-=7;
else
green=hgreen
greenx = convert[green]
}

if (blue<hblue){
if ((blue+7)<hblue)
blue+=7;
else
blue=hblue
bluex = convert[blue]
}
else{
if ((blue-7)>hblue)
blue-=7;
else
blue=hblue
bluex = convert[blue]
}

rgb = "#"+redx+greenx+bluex;
textanimstyle.color=rgb;
if(link)
textanimlinktag.style.color=rgb;
if (z<38){
textanimstyle.top = (parseInt(textanimstyle.top) - 1) + 'px';
z++
timer1 = setTimeout(function(){up();}, dt)
}
else
{
updwn=false;
down()
}
}


function down(){
if (red<ered){
if ((red+7)<ered)
red+=7;
else
red=ered
redx = convert[red]
}
else{
if ((red-7)>ered)
red-=7;
else
red=ered
redx = convert[red]
}

if (green<egreen){
if ((green+7)<egreen)
green+=7;
else
green=egreen
greenx = convert[green]
}
else{
if ((green-7)>egreen)
green-=7;
else
green=egreen
greenx = convert[green]
}

if (blue<eblue){
if ((blue+7)<eblue)
blue+=7;
else
blue=eblue
bluex = convert[blue]
}
else{
if ((blue-7)>eblue)
blue-=7;
else
blue=eblue
bluex = convert[blue]
}

rgb = "#"+redx+greenx+bluex;
textanimstyle.color=rgb;
if(link)
textanimlinktag.style.color=rgb;

if (z<76){
textanimstyle.top = (parseInt(textanimstyle.top) - 1) + 'px';
z++
timer2 = setTimeout(function(){down();}, dt)
}
else
{
textanimtag.innerHTML='';
window.clearInterval(timer2);
if(msg<message.length-1){
msg++;
z=0;
textanimstyle.top=res + 'px';
timer3 = setTimeout(function(){start();}, 100);
}
else
{
msg=0;
z=0;
textanimstyle.top=res + 'px';
timer3 = setTimeout(function(){start();}, 2000);
}
}
}
})();

</script>
</head>
<body background="blue blocks.jpg" bgcolor="#00ccff">
<div id=textanim style="left: 0px; position: absolute; top: 200px"
onclick="breakf();"></div></body></html>