[Edit]
Czy przy wysylaniu tego naglowka przegladarka moze nie obslugiwac
document.getElementById();


w konsoli javascript dostaje taki komunikat
Cytat
Błąd: document.getElementById("fscroller") has no properties
Plik źródłowy:
http://localhost/Socrates2/Wiersz: 55
a czy mozesz mi pokazac przyklad, podac link lub cos wiecej powiedziec ? Szukalem o DOM w necie ale na w3c.org jest to tak zakrecone ze nie dalem rady zrozumiec, na w3school jest ale to jest taki sam javascript (tak mi sie wydaje). W skrypcie nie uzywam document write. jedyne co moze byc jakos powiazane innerHTML.
Zadnych document.all juz nie ma bo pozamienialem je na document.getElementById
Tak bynajmniej na mozilla faq bylo napisane.
Nie jest to moj skrypt, ja jedynie go staram sie przerobic pod xhtml z naglowkiem
<script type="text/javascript"> <![CDATA[
var delay=3000 //set delay between message change (in miliseconds)
var fcontent=new Array()
begintag='<font face="verdana" size="1">'
fcontent[0]="
<span style='color:grey;font-weight:bold'>:: Socrates-CMS.pl ::
</span> :: 0 Uzytkownikow, 1 gosci"
fcontent[1]="
<span style='color:grey;font-weight:bold'>:: Socrates-CMS.pl ::
</span> ::
</span>19672 odslon, 7349 wizyt"
fcontent[2]="
<span style='color:grey;font-weight:bold'>:: Socrates-CMS.pl ::
</span> </span>12312 plikow ktore w sumie zajmuja 3242 GB"
var fwidth='400px' //set scroller width
var fheight='14px' //set scroller height
var fadescheme=0 //set 0 to fade text color from (white to black), 1 for (black to white)
var fadelinks=1 //should links inside scroller content also fade like text? 0 for no, 1 for yes.
var hex=(fadescheme==0)? 240 : 0
var startcolor=(fadescheme==0)? "rgb(240,240,240)" : "rgb(0,0,0)"
var endcolor=(fadescheme==0)? "rgb(0,0,0)" : "rgb(240,240,240)"
var DOM2=document.getElementById
var faderdelay=0
var index=0
if (DOM2)
faderdelay=3000
//function to change content
function changecontent(){
if (index>=fcontent.length)
index=0
if (DOM2){
document.getElementById("fscroller").style.color=startcolor
document.getElementById("fscroller").innerHTML=begintag+fcontent[index]+closetag
linksobj=document.getElementById("fscroller").getElementsByTagName("A")
if (fadelinks)
linkcolorchange(linksobj)
colorfade()
}
index++
setTimeout("changecontent()",delay+faderdelay)
}
frame=20;
function linkcolorchange(obj){
if (obj.length>0){
for (i=0;i<obj.length;i++)
obj[i].style.color="rgb("+hex+","+hex+","+hex+")"
}
}
function colorfade() {
// 20 frames fading process
if(frame>0) {
hex=(fadescheme==0)? hex-12 : hex+12 // increase or decrease color value depd on fadescheme
document.getElementById("fscroller").style.color="rgb("+hex+","+hex+","+hex+")"; // Set color value.
if (fadelinks)
linkcolorchange(linksobj)
frame--;
setTimeout("colorfade()",5);
}
else{
document.getElementById("fscroller").style.color=endcolor;
frame=20;
hex=(fadescheme==0)? 255 : 0
}
}
window.onload=changecontent
]]>