Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
It displays works well with Internet Explorer but fails to work with mozila and opera

XML
<html>

<head>

<script language="JavaScript1.2">

var size = 25;
var speed_between_messages=1500  //in miliseconds


var tekst = new Array()
{
tekst[0] = "Welcome";
tekst[1] = "Home";
tekst[2] = "Feel";
tekst[3] = "Free";
}
var klaar = 0;
var s = 0;
var veran =0;
var tel = 0;
function bereken(i,Lengte)
{
return (size*Math.abs( Math.sin(i/(Lengte/3.14))) );
}

function motor(p)
{
var output = "";
for(w = 0;w < tekst[s].length - klaar+1; w++)
{
q = bereken(w/2 + p,16);
if (q > size - 0.5)
{klaar++;}
if (q < 5)
{tel++;
if (tel > 1)
{
tel = 0;
if (veran == 1)
{
veran = 0;
s++;
if ( s == tekst.length)
{s = 0;}
p = 0;
if (window.loop)
{clearInterval(loop)}
loop = motor();
}
}
}
output += "<font style='font-size: "+ q +"pt'>" +tekst[s].substring(w,w+1)+ "</font>";
}
for(k=w;k<klaar+w;k++)
{
output += "<font style='font-size: " + size + "pt'>" +tekst[s].substring(k,k+1)+ "</font>";
}
idee.innerHTML = output;
}

function startmotor(p){
if (!document.all)
return
var loop = motor(p);
if (window.time)
{clearInterval(time)}
if (klaar == tekst[s].length)
{
klaar = 0;
veran = 1;
tel = 0;
var time = setTimeout("startmotor(" +(p+1) + ")", speed_between_messages);
}else
{
var time =setTimeout("startmotor(" +(p+1) + ")", 50);
}

}

</script>

<div ID="idee"></div>
 </head>

 <body onload="startmotor(0)">
 </body>

 </html>
Posted
Comments
ZurdoDev 8-Aug-13 16:12pm    
What does fails to work mean?

1 solution

Just remove this part:

JavaScript
if (!document.all)
return


For future reference, make sure you download Firebug[^], a Firefox extension which allows you to debug your scripts (and I do believe Opera has developer tools built in as well). Using that, the JavaScript console showed this message:

Non-standard document.all property was used. Use W3C standard document.getElementById() instead.
if (!document.all)


As you're not using document.all anywhere else, removing it makes sure the script works.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 8-Aug-13 17:05pm    
Good catch, a 5.
—SA
braop 8-Aug-13 17:18pm    
thankx...it works cool

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900