Witam, mam następujący problem z poniższym kodem java script - otóż w przeglądarkach od IE10 w dół jest wyświetlany prawidłowo, natomiast w IE11 i w Firefoxie w ogóle się nie uruchamia.
Poniższy script wyświetla tekst w formie neonu i powiększa dynamicznie obrazek, oto kod:
[ SEKCJA HTML ]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<meta name="Description" />
<meta name="keywords" content=" />
<meta name=" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<script>
var speed = 50;
var sizeX = 632;
var sizeY = 356;
var stepX = 0;
var stepY = 0;
var steps = 100;
var imgObj;
function ustaw()
{
imgObj = document.getElementById('obrazekId');
stepX = Math.ceil(sizeX / steps);
stepY = Math.ceil(sizeY / steps);
}
function resize()
{
currentW = imgObj.width;
currentH = imgObj.height;
if ((currentW < sizeX) && (currentH < sizeY)){
imgObj.width = currentW + stepX;
imgObj.height = currentH + stepY;
setTimeout("resize()", speed);
}
}
</script>
<script language="JavaScript">
<!--
function tekstArrayInit(){
tekst=new Array(4);
tekst[0]="JAKIŚ TEKST 1";
tekst[1]="JAKIŚ TEKST 2";
tekst[2]="JAKIŚ TEKST 3";
tekst[3]="JAKIŚ TEKST 4";
}
function PiszText(){
tekstArrayInit();
textToWrite+=tekst[t].substring(position,position+1);
Written="<center><font size='5' color='#ffffff'><b>"+textToWrite+"</b></font></center>";
if (document.all){
tekstSpan.innerHTML=Written
}
else{
document.layers.tekst1Span.document.write(Written);
document.layers.tekst1Span.document.close()
}
if (position==tekst[t].length-1){
t++
t=t % 4
position=0;
textToWrite="";
speed1=5000;
}
else{
position++;
speed1=150
}
setTimeout("PiszText()",speed1)
}
function AppInit(){
t=0;
textLen=0;
textToWrite="";
position=0;
PiszText();
}
//-->
</script>
</head>
<body onload="AppInit();ustaw();resize()">
<br />
<span id="tekstSpan" style="top: 0pt;"></span>
<span id="tekst1Span" style="position: absolute; top: 0pt;"></span>
<div id="styl1">
<div id="imgLayer"><a href="JAKIŚ_ODNOŚNIK_DO_STRONY"><img src="JAKIS_OBRZAEK.jpg" name="obrazek" id="obrazekId" height="1" width="1" /></a></div>
</div>
</body>
</html>
[ SEKCJA CSS]
body{
background: #000;
}
.both{
clear: both;
}
#styl1 {
background: #aa0202;
border: 30px solid black;
padding: 50px;
position: relative;
min-height: 1px;
}
a{
text-decoration:none;
color:#ffffff;
}
a:hover{ text-decoration:none; }
Bardzo bym prosił o napisanie co jest źle w tym kodzie i dlaczego nie jest kompatybilny ze wszystkimi przeglądarkami, pozdrawiam.