Главная » 2009 » Сентябрь » 23 » Плавная прокрутка ссылок (Javascript)
23.09.2009, 15:09

Плавная прокрутка ссылок



на скрине этого не покажешь.

После </head> ставим это:

Quote
<STYLE>
<!--
#tickertape{position:relative; layer-background-color:black; width:400; height:12; }#subtickertape{background-color:black; position:absolute; border: 1px solid black; width:400; height:12; }.subtickertapefont{font:bold 12px Verdana; text-decoration:none; color:white; }.subtickertapefont a{color:white; text-decoration:none;}-->
</STYLE>
<BODY>
<DIV ID="tickertape">
<DIV ID="subtickertape" CLASS="subtickertapefont">Initializing...</DIV>
</DIV>

<SCRIPT language="JavaScript1.2">

var speed=4500

var news=new Array()

news[0]="<a href='http://webscripts.ucoz.ru'>Сборник скриптов</a>"
news[1]="<a href='http://webscripts.ucoz.ru/forum'>Форум вебмастера</a>"
news[2]="<a href='http://webscripts.ucoz.ru'>Бесплатные скрипты</a>"

i=0
if (document.all)
tickerobject=document.all.subtickertape.style
else
tickerobject=document.tickertape.document
function regenerate(){
window.location.reload()
}
function regenerate2(){
if (document.layers)
setTimeout("window.onresize=regenerate",450)
}
function update(){
BgFade(0xff,0xff,0xff, 0x00,0x00,0x00,10);
if (document.layers){

document.tickertape.document.subtickertape.document.write('<span class="subtickertapefont">'+news[i]+'</span>')
document.tickertape.document.subtickertape.document.close()
} else
document.all.subtickertape.innerHTML=news[i]

if (i<news.length-1)
i++
else
i=0
setTimeout("update()",speed)
}

function BgFade(red1, grn1, blu1, red2,
grn2, blu2, steps) {
sred = red1; sgrn = grn1; sblu = blu1;
ered = red2; egrn = grn2; eblu = blu2;
inc = steps;
step = 0;
RunFader();
}
function RunFader() {
var epct = step/inc;
var spct = 1 - epct;
if (document.layers)
tickerobject.bgColor =
Math.floor(sred * spct + ered *
epct)*256*256 +
Math.floor(sgrn * spct + egrn * epct)*256 +
Math.floor(sblu * spct + eblu * epct);
else
tickerobject.backgroundColor=
Math.floor(sred * spct + ered *
epct)*256*256 +
Math.floor(sgrn * spct + egrn * epct)*256 +
Math.floor(sblu * spct + eblu * epct);
if ( step < inc ) {
setTimeout('RunFader()',50);
}
step++;
}
</SCRIPT>

В body добавляем onload, вот так:

Code
<BODY onLoad="regenerate2();update()">

Красное меняем на свое.

Материал взят с сайта infoscript.ru
Внимание! Копирование данного материала запрещено без указания ссылки на сайт Infoscript.ru
Источник/Автор: Неизвестен
Категория: JavaScript's | Просмотров: 2399 | Добавил: antisept | Рейтинг: 4.0/1 |
Теги: Плавная прокрутка ссылок
Пока комментариев нет. Ты можешь быть первым!
Добавлять комментарии могут только зарегистрированные пользователи.
[ Регистрация | Вход ]