Форум: Форум PHPФорум ApacheФорум Регулярные ВыраженияФорум MySQLHTML+CSS+JavaScriptФорум FlashРазное
Новые темы: 0000000
PHP 5/6. В подлиннике. Авторы: Кузнецов М.В., Симдянов И.В. MySQL на примерах. Авторы: Кузнецов М.В., Симдянов И.В. Объектно-ориентированное программирование на PHP. Авторы: Кузнецов М.В., Симдянов И.В. Самоучитель PHP 5 / 6 (3 издание). Авторы: Кузнецов М.В., Симдянов И.В. PHP. Практика создания Web-сайтов (второе издание). Авторы: Кузнецов М.В., Симдянов И.В.
ВСЕ НАШИ КНИГИ
Консультационный центр SoftTime

HTML+CSS+JavaScript

Выбрать другой форум

 

Здравствуйте, Посетитель!

вид форума:
Линейный форум Структурный форум

тема: Скролинг текста
 
 автор: Akira   (20.02.2005 в 03:34)   письмо автору
 
 


<html>
<head>
<title>WOweb.ru - Scripts - JavaScript - Scroll In Table</title>
<META http-equiv="Content-Type" content="text/html; charset=windows-1251">
 <Style>
   A:Link{ Color: #000000; Text-decoration: underline}
   A:Visited{ Color: #000000; Text-decoration: underline}
   A:Hover{ Color: #000000; Text-decoration: none}
 td, body {font-family: verdana, arial, helvetica; font-size:11px;}  
 </Style>

<!-- HEAD START HERE -->

<script language="JavaScript1.2">

var message= new Array()

// Please read section 2 above on how the messages have to be configured.
// You may add as many messages as you like!
message[0]="Ссылка?|Можно вставлять ссылки, количество сообщений неограниченно|http://www.woweb.ru"

message[1]="Clinton Bashes NY Mayor|Speaking to 1,000 teacher aides on Saturday, Hillary Rodham Clinton attacked Mayor Rudolph Giuliani's positions on education.|http://www.woweb.ru"

message[2]="House Bill Curbs Sex Slavery|A House bill designed to protect victims of the growing international sex slavery trade would allow child victims brought to this country to stay in America.|http://www.woweb.ru"

// Размер коробки (высота)
var scrollerheight=150

// Размер коробки (ширина)
var scrollerwidth=150

// Месторасположение (сверху)
var scrollertop=110

// Месторасположение (слева)
var scrollerleft=110

// The padding between the scrollerbox and the text (pixels)
var scrollerpadding=10

// Рамка у коробки
var backgroundborder=0

// The background-colour of the scrollerbox
var scrollerbgcolor="DDDDDD"

// Font attributes of the title
var font_titleface="Verdana"
var font_titlecolor="FF0000"
var font_titlesize=1

// Font attributes of the copytext
var font_copyface="Verdana"
var font_copycolor="660000"
var font_copysize=1

// standstill between the messages (milliseconds)
var standstillfix=3000

// Do not edit below this line
var cliptop=0
var clipbottom=scrollerheight-2*scrollerpadding
var clipleft=0
var clipright=scrollerheight

var i_message=0
var mes_joined
var mes_split
var contenttext
var contentbg

var totalheight=scrollerheight*(message.length)
var i_height=0
var step=1
var pause=20

var standstillflex=0

function initiate(){
 contenttext="<table cellpadding=0 cellspacing=0 border=0 width="+(scrollerwidth-2*scrollerpadding)+">"
 contenttext+="<tr valign='top'><td height='"+scrollerheight+"'><br></td></tr>"
 for (i=0;i<=message.length-1;i++) {
  mes_joined=message[i]
  mes_split=mes_joined.split("|")
  contenttext+="<tr valign='top'><td height='"+scrollerheight+"'><a href='"+mes_split[2]+"'><font face='"+font_titleface+"' color='"+font_titlecolor+"' size='"+font_titlesize+"'>"+mes_split[0]+"</font></a><br><font face='"+font_copyface+"' color='"+font_copycolor+"' size='"+font_copysize+"'>"+mes_split[1]+"</font></td></tr>"
 }
 contenttext+="</table>"
 
 contentbg="<table cellpadding=0 cellspacing=0 border="+backgroundborder+" width='"+scrollerwidth+"'><tr><td height='"+scrollerheight+"' bgcolor="+scrollerbgcolor+">&nbsp;</td></tr></table>"
 
 if (document.all) {
  scrollertext.innerHTML=contenttext
  scrollerbg.innerHTML=contentbg
  document.all.scrollertext.style.posTop=scrollertop
  document.all.scrollertext.style.posLeft=scrollerleft
  document.all.scrollerbg.style.posTop=scrollertop-scrollerpadding
  document.all.scrollerbg.style.posLeft=scrollerleft-scrollerpadding
  document.all.scrollertext.style.clip="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
 }
 if (document.layers) {
  document.scrollertext.document.write(contenttext)
  document.scrollertext.document.close()
  document.scrollerbg.document.write(contentbg)
  document.scrollerbg.document.close()
  document.scrollertext.top=scrollertop
  document.scrollertext.left=scrollerleft
  document.scrollerbg.top=scrollertop-scrollerpadding
  document.scrollerbg.left=scrollerleft-scrollerpadding 
  document.scrollertext.clip.left=clipleft
        document.scrollertext.clip.right=clipright
        document.scrollertext.clip.top=cliptop
        document.scrollertext.clip.bottom=clipbottom
 }
 scroll()
}

function scroll(){
 standstillflex=standstillfix
 if (document.all){
  if (i_height<scrollerheight) {
   i_height+=step
   cliptop+=step
   clipbottom+=step
   document.all.scrollertext.style.clip="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
   document.all.scrollertext.style.posTop-=step
   var timer=setTimeout("scroll()",pause)
  }

  else {
   if (document.all.scrollertext.style.posTop<=-(totalheight)) {
    document.all.scrollertext.style.posTop=scrollertop
    cliptop=0
    clipbottom=scrollerheight-2*scrollerpadding
    document.all.scrollertext.style.clip="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
    standstillflex=0
   }
   i_height=0
   clearTimeout(timer)
   var timer=setTimeout("scroll()",standstillflex)
  }
 }
 
  if (document.layers){
   if (i_height<scrollerheight) {
    i_height+=step
    cliptop+=step
    clipbottom+=step
    document.scrollertext.clip.left=clipleft
          document.scrollertext.clip.right=clipright
          document.scrollertext.clip.top=cliptop
          document.scrollertext.clip.bottom=clipbottom
    document.scrollertext.top-=step
    var timer=setTimeout("scroll()",pause)
   }

  else {
   if (document.scrollertext.top<=-(totalheight)) {
    document.scrollertext.top=scrollertop
    cliptop=0
    clipbottom=scrollerheight-2*scrollerpadding
    document.scrollertext.clip.left=clipleft
          document.scrollertext.clip.right=clipright
          document.scrollertext.clip.top=cliptop
          document.scrollertext.clip.bottom=clipbottom
    standstillflex=0
   }
   i_height=0
   clearTimeout(timer)
   var timer=setTimeout("scroll()",standstillflex)
  }
 }
}

</script>


<!-- HEAD END HERE -->




</head>
<body bgcolor="#EDEDED" text="#000000" link="#000000" topmargin="0" leftmargin="0" onLoad="initiate()">
<center>

<!-- BODY START HERE -->

<div id="scrollerbg" style="position:absolute; top:121px; left: 339px;">&nbsp;</div>
<div id="scrollertext" style="position:absolute; top:120px; left: 339px; width: 2px;">&nbsp;</div>
<DIV id="deletethisdiv" style="position:absolute;top:125px;left:340px"></DIV>

<!-- BODY END HERE -->
</center>


</body>
</html>

Кто сможет мне помочь?
Надо создать что бы текст скролинга был в теге <div id=scrol></div>
Т.е. Куда тег div туда и текст (в коде месторасположение устанавливаеться в скрипте что в корне не утраивает)
И вообще как такая функция делаеться?

   
 
 автор: elenaki   (20.02.2005 в 11:35)   письмо автору
 
   для: Akira   (20.02.2005 в 03:34)
 

ваш скрипт не работает

сходите на http://www.kruglov.ru/klayers/, там есть класс для скроллинга, который должен работать во всех броузерах

   
 
 автор: Crux   (20.02.2005 в 14:23)   письмо автору
 
   для: elenaki   (20.02.2005 в 11:35)
 

скрипт рабочий, просто это глюк форума.
83 строка должна выглядеть так mes_joined=message[ i ]

вот только я не понял чего тербуется сделать

PS админы, вы когда хост смените, тормозит всё немоверно, да ещё сообщение с третьего раза запостилось...

   
Rambler's Top100
вверх

Rambler's Top100 Яндекс.Метрика Яндекс цитирования