Mam problem z pewnym kodem js.
Otóż chciałbym, żeby napisy były wyświetlane na jakimś tle, np. czarnym.
Po ustawieniu tego
nic się nie zmienia na stronie. Może jest to spowodowane tym, że js jest w sekcji
?
Podaję kod skryptu:
<!-- STEP I: Goes between <HEAD> & </HEAD> tags
You may keep it, change or ignore it!
Or linking to an External Style Sheet:
<LINK REL=StyleSheet HREF="yourstyle.css">
without other style tags -->
<!-- STEP II: Goes between <HEAD> & </HEAD> tags
Or linking to an External js file:
<script language="javascript" src="yourfile.js"></script>
without other script tags -->
<script LANGUAGE="JavaScript">
/***********************************
* This notice may not be removed
***********************************/
//-- Begin Scroller's Parameters and messages -->
//scroller's width
var swidth=330;
//scroller's height
var sheight=22;
//scroller's speed
var sspeed=4;
var restart=sspeed;
var rspeed=sspeed;
//scroller's pause
var spause=2400;
//scroller's background
var sbcolor="white";
//messages: change to your own; use as many as you'd like; set up Hyperlinks to URLs as you normally do:
<a target=... href="... URL ...">..message..
</a>var singletext=new Array();
singletext[0]='
<TABLE WIDTH=330 BORDER=0 BGCOLOR=0><TR><TD WIDTH=20>'+
'2
</TD> <TD WIDTH=250><A HREF=#><FONT COLOR=yellow FACE=verdana SIZE=2>Circle Line
</FONT></A></TD> <TD WIDTH=60>1 min
</TD></TR>';
singletext[1]='
<TABLE WIDTH=330 BORDER=0 BGCOLOR=0><TR><TD WIDTH=20>3
</TD> <TD WIDTH=250><A HREF=#><FONT COLOR=green FACE=verdana SIZE=2>Light Rail Line
</FONT></A></TD> <TD WIDTH=60>2 mins
</TD></TR></TABLE>';
singletext[2]='
<TABLE WIDTH=330 BORDER=0 BGCOLOR=0><TR><TD WIDTH=20>4
</TD> <TD WIDTH=250><A HREF=#><FONT COLOR=blue FACE=verdana SIZE=2>Central Line
</FONT></A></TD> <TD WIDTH=60>2 mins
</TD></TR></TABLE>';
singletext[3]='
<TABLE WIDTH=330 BORDER=0 BGCOLOR=0><TR><TD WIDTH=20>5
</TD> <TD WIDTH=250><A HREF=#><FONT COLOR=gray FACE=verdana SIZE=2>Underground Line
</FONT></A></TD> <TD WIDTH=60>2 mins
</TD></TR></TABLE>';
//singletext[...]='...';
//-- end Parameters and message -->
//-- begin: Scroller's Algorithm -->
var ii=0;
function goup(){if(sspeed!=rspeed*8){sspeed=sspeed*2;restart=sspeed;}}
function godown(){if(sspeed>rspeed){sspeed=sspeed/2;restart=sspeed;}}
function start(){
if(document.getElementById){ns6div=document.getElementById('iens6div');ns6div.style.top=sheight;ns6div.innerHTML=singletext[0];sizeup=ns6div.offs
etHeight;ns6scroll();}
else
if(document.layers){ns4layer=document.ns4div.document.ns4div1;ns4layer.top=sheight;ns4layer.do
cument.write(singletext[0]);ns4layer.document.close();sizeup=ns4layer.document.height;ns4scroll();}
else
if(document.all){iediv=iens6div;iediv.style.pixelTop=sheight;iediv.innerHTML=singletext[0];
sizeup=iediv.offsetHeight;iescroll();}}
function iescroll(){if(iediv.style.pixelTop>0&&iediv.style.pixelTop<=sspeed){iediv.style.pixelTop=0;setTimeout("iescroll()",spause);}else
if(iediv.style.pixelTop>=sizeup*-1){iediv.style.pixelTop-=sspeed;setTimeout("iescroll()",100);}else{if(ii==singletext.length-1)ii=0;else ii++;iediv.style.pixelTop=sheight;iediv.innerHTML=singletext[ii];sizeup=iediv.of
fsetHeight;iescroll();}}
function ns4scroll(){if(ns4layer.top>0&&ns4layer.top<=sspeed){ns4layer.top=0;setTimeout("ns4scroll()",spause);}else
if(ns4layer.top>=sizeup*-1){ns4layer.top-=sspeed;setTimeout("ns4scroll()",100);}else{if(ii==singletext.length-1)ii=0;else ii++;ns4layer.top=sheight;ns4layer.document.write(singletext[ii]);ns4layer.document.close();sizeup=ns4layer.document.height;ns4scroll();}}
function ns6scroll(){if(parseInt(ns6div.style.top)>0&&parseInt(ns6div.style.top)<=sspeed){ns6div.style.top=0;setTimeout("ns6scroll()",spause);}else
if(parseInt(ns6div.style.top)>=sizeup*-1){ns6div.style.top=parseInt(ns6div.style.top)-sspeed;setTimeout("ns6scroll()",100);}
else{if(ii==singletext.length-1)ii=0;else ii++;
ns6div.style.top=sheight;ns6div.innerHTML=singletext[ii];sizeup=ns6div.offsetHei
ght;ns6scroll();}}
//-- end Algorithm -->
<!-- End of Script between <head> & </head> tags-->
<!-- STEP III: Make sure start() is loaded -->
<BODY onLoad="start()" BGCOLOR=000000>
<!-- STEP IV: Goes between <BODY ... > & </BODY> tags
begin: body code -->
<!-- You may remove last cell below (<td> ... </td>) to get rid of Speed-change -->
<TABLE WIDTH=310 BORDER=0><TR><TD WIDTH=20>1
</TD> <TD WIDTH=250><A HREF=#><FONT COLOR=red FACE=verdana SIZE=2>East Line
</FONT></A></TD> <TD WIDTH=40>1 min
</TD></TR>
<script language="JavaScript">if(document.layers){document.write('
<ilayer id="ns4div" width='+swidth+' height='+sheight+' bgcolor='+sbcolor+'><layer id="ns4div1" width='+swidth+' height='+sheight+' onmouseover="sspeed=0;" onmouseout="sspeed=restart"></layer></ilayer>')}
if(document.getElementById||document.all){document.write('
<div style="position:relative;overflow:hidden;width:'+swidth+';height:'+sheight+';clip:rect(0 '+swidth+' '+sheight+' 0);background-color:'+sbcolor+';" onmouseover="sspeed=0;" onmouseout="sspeed=restart"><div id="iens6div" style="position:relative;width:'+swidth+';"></div></div>');}
</script><!-- end code between body tags -->
Problem w tym, że nie ma czarnego tła, jest ono dla każdej wiadomości, ale to po ustawieniu przy właściwościach singletext. Gdy poszczególne wiadomości się przesuwają, widać biały pasek, tego nie chcę - chciałbym, żeby było tło czarne i tyle.
Da się to zrobić?
Trzebaby w skrypcie coś dopisać pewnie, tylko ja nie wiem, co.
Ten post edytował olme 26.03.2007, 13:44:49
Being a barber is a lot like being a barman or a soda jerk. There's not much to it once you've learned the basic moves. (...)
I just cut the hair.