Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Automatycznie przewijana ramka
Forum PHP.pl > Forum > Przedszkole
Roguś
Moze mi ktos napisac najlepiej skrypt czy funkcje by ramka sie sama przewijała?
KRZ
Radzę lepiej opisać problem/prośbę. O co dokładnie ci chodzi, może o ramki w html? Wtedy nie będzie potrzebny żaden skrypt php.

Jeśli to miałeś na myśli wystarczy:

  1. <frame scrolling="typ" />


* "typ" podmień na:
"yes", "no", "auto" - ramka odpowiednio, będzie posiadać paski przewijania, w drugim przypadku będzie ich pozbawiona niezależnie od wielkości "obiektu", a w trzecim przegladarka automatycznie ustali czy wyświetlić paski.
Roguś
A wiec to co mi napisałes to wiem i zastosuje ale chodzi mi o to by ramka cały czas przwewijała sie np do góry i wyświetlała swoja zawartosc cylkicznie czyli przewija sie przewija, pokazuje zawartosc, koniec tekstu i leci od początku. tak automatycznie.
ARJ
http://webmaster.helion.pl/kurshtml/skrypt/scrolwin.htm <= tutaj masz przewijanego pop-up`a, kilka zmian i powinno przewijać ramki. temat powinien być w dziale Java Script.
Roguś
A ja znalazłem ten skrypt. Jest on własnie taki jaki chce tylko nie umiem wprowadzić do niego zawartości. Pierwszy skrypt php napisałem sam bo chce by otwierał mi plik tekstowy ksiegagosci.txt . Lecz nie umiem wyswietlic go w tej ramce. Cos tam próbowałem ale mi nie wychodzi sad.gif tekst wyswietlany przez ta ramke trzeba wpisać w var content= w 11 linijce. Może mi ktos pomóc ?
  1. <?
  2.  @$wp = fopen("dane/ksiegagosci.txt", 'r');
  3. $tekst = fgets($wp, 999);
  4.  
  5. fclose($wp);
  6. ?>
  7. <script language=javascript>
  8.  
  9.  
  10. //ENTER CONTENT TO SCROLL BELOW.
  11. var content= ("$tekst") ; 
  12.  
  13. var boxheight=150; // BACKGROUND BOX HEIGHT IN PIXELS.
  14. var boxwidth=150;  // BACKGROUND BOX WIDTH IN PIXELS.
  15. var boxcolor="#ededed";  // BACKGROUND BOX COLOR.
  16. var speed=70;  // SPEED OF SCROLL IN MILLISECONDS (1 SECOND=1000 MILLISECONDS)..
  17. var pixelstep=2; // PIXELS "STEPS" PER REPITITION.
  18. var godown=false;  // TOP TO BOTTOM=TRUE , BOTTOM TO TOP=FALSE
  19.  
  20. // DO NOT EDIT BEYOND THIS POINT
  21.  
  22. var outer,inner,elementheight,ref,refX,refY;
  23. var w3c=(document.getElementById)?true:false;
  24. var ns4=(document.layers)?true:false;
  25. var ie4=(document.all && !w3c)?true:false;
  26. var ie5=(document.all && w3c)?true:false;
  27. var ns6=(w3c && navigator.appName.indexOf("Netscape")>=0)?true:false;
  28. var txt='';
  29. if(ns4){
  30. txt+='<table cellpadding=0 cellspacing=0 border=0 height='+boxheight+' width='+boxwidth+'><tr><td>';
  31. txt+='<ilayer name="ref" bgcolor="'+boxcolor+'" width='+boxwidth+' height='+boxheight+'></ilayer>';
  32. txt+='</td></tr></table>'
  33. txt+='<layer name="outer" bgcolor="'+boxcolor+'" visibility="hidden" width='+boxwidth+' height='+boxheight+'>';
  34. txt+='<layer name="inner" width='+(boxwidth-4)+' height='+(boxheight-4)+' visibility="hidden" left="2" top="2" >'+content+'</layer>';
  35. txt+='</layer>';
  36. }else{
  37. txt+='<div id="ref" style="position:relative; width:'+boxwidth+'; height:'+boxheight+'; background-color:'+boxcolor+';" ></div>';
  38. txt+='<div id="outer" style="position:absolute; width:'+boxwidth+'; height:'+boxheight+'; visibility:hidden; background-color:'+boxcolor+'; overflow:hidden" >';
  39. txt+='<div id="inner" style="position:absolute; visibility:visible; left:2px; top:2px; width:'+(boxwidth-4)+'; overflow:hidden; cursor:default;">'+content+'</div>';
  40. txt+='</div>';
  41. }
  42. document.write(txt);
  43.  
  44. function getElHeight(el){
  45. if(ns4)return (el.document.height)? el.document.height : el.clip.bottom-el.clip.top;
  46. else if(ie4||ie5)return (el.style.height)? el.style.height : el.clientHeight;
  47. else return (el.style.height)? parseInt(el.style.height):parseInt(el.offsetHeight);
  48. }
  49.  
  50. function getPageLeft(el){
  51. var x;
  52. if(ns4)return el.pageX;
  53. if(ie4||w3c){
  54. x = 0;
  55. while(el.offsetParent!=null){
  56. x+=el.offsetLeft;
  57. el=el.offsetParent;
  58. }
  59. x+=el.offsetLeft;
  60. return x;
  61. }}
  62.  
  63. function getPageTop(el){
  64. var y;
  65. if(ns4)return el.pageY;
  66. if(ie4||w3c){
  67. y=0;
  68. while(el.offsetParent!=null){
  69. y+=el.offsetTop;
  70. el=el.offsetParent;
  71. }
  72. y+=el.offsetTop;
  73. return y;
  74. }}
  75.  
  76. function scrollbox(){
  77. if(ns4){
  78. inner.top+=(godown)? pixelstep: -pixelstep;
  79. if(godown){
  80. if(inner.top>boxheight)inner.top=-elementheight;
  81. }else{
  82. if(inner.top<2-elementheight)inner.top=boxheight+2;
  83. }}else{
  84. inner.style.top=parseInt(inner.style.top)+((godown)? pixelstep: -pixelstep)+'px';
  85. if(godown){
  86. if(parseInt(inner.style.top)>boxheight)inner.style.top=-elementheight+'px';
  87. }else{
  88. if(parseInt(inner.style.top)<2-elementheight)inner.style.top=boxheight+2+'px';
  89. }}}
  90.  
  91. window.onresize=function(){
  92. if(ns4)setTimeout('history.go(0)', 400);
  93. else{
  94. outer.style.left=getPageLeft(ref)+'px';
  95. outer.style.top=getPageTop(ref)+'px';
  96. }}
  97.  
  98. window.onload=function(){
  99. outer=(ns4)?document.layers['outer']:(ie4)?document.all['outer']:document.getElementById('outer');
  100. inner=(ns4)?outer.document.layers['inner']:(ie4)?document.all['inner']:document.getElementById('inner');
  101. ref=(ns4)?document.layers['ref']:(ie4)?document.all['ref']:document.getElementById('ref');
  102. elementheight=getElHeight(inner);
  103. if(ns4){
  104. outer.moveTo(getPageLeft(ref),getPageTop(ref));
  105. outer.clip.width=boxwidth;
  106. outer.clip.height=boxheight;
  107. inner.top=(godown)? -elementheight : boxheight-2;
  108. inner.clip.width=boxwidth-4;
  109. inner.clip.height=elementheight;
  110. outer.visibility="show";
  111. inner.visibility="show";
  112. }else{
  113. outer.style.left=getPageLeft(ref)+'px';
  114. outer.style.top=getPageTop(ref)+'px';
  115. inner.style.top=((godown)? -elementheight : boxheight)+'px';
  116. inner.style.clip='rect(0px, '+(boxwidth-4)+'px, '+(elementheight)+'px, 0px)';
  117. outer.style.visibility="visible";
  118. }
  119. setInterval('scrollbox()',speed);
  120. }
  121. </SCRIPT>
ARJ
linia 11 var content= ("<?=$tekst?>") ;
Roguś
Chyba nie to :/ nic mi sie wtedy nie wyświetla sad.gif
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.