Модераторы: Sardar, Aliance
  

Поиск:

Ответ в темуСоздание новой темы Создание опроса
> скроллинг 
:(
    Опции темы
kazakru
Дата 15.6.2006, 04:14 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 3
Регистрация: 15.6.2006

Репутация: нет
Всего: нет



простите если что не так.
можно ли разместить два скрипта на одной странице что бы они независимо друг от друга работали?



Код

<script type="text/javascript">
<!--
/*
Original Javascript code by dynamic drive.
Modified javascript code by SuperCat [URL=http://www.ourscripts.net]http://www.ourscripts.net[/URL]
Special thanks to Dilandou for helping me with the PHP and JS mixing.
Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com)
For full source code, 100's more DHTML scripts, and TOS, visit [URL=http://www.dynamicdrive.com]http://www.dynamicdrive.com[/URL]
Credit MUST stay intact
*/

// Start edit speed and size settings

var marqueewidth="100%" //Specify the marquee's width (in pixels) (keep in mind any cell padding and images you may have in your themes).
var marqueeheight="100px" //Specify the marquee's height
var scrollinterval=50 // Specify the refresh rate. This affects speed too. Larger is slower.
var pauseit=1 //Pause marquee onMousever of text area (0=no. 1=yes)?

// End edit speed and size settings

////NO NEED TO EDIT BELOW THIS LINE////////////

var marqueecontent='<p><?php echo "$mid_content"; ?></p>';
var direction='<?php echo "$direction"; ?>';

if (direction=='up') {
// Scroll upwards start
var marqueespeed=1 // Specify speed (larger is faster 1-10) This is the amount of pixel movement per refresh. 1 is best for smoothness.
marqueespeed=(document.all)? marqueespeed : Math.max(1, marqueespeed-1) //slow speed down by 1 for NS
var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var iedom=document.all||document.getElementById
var actualheight=''
var cross_marquee, ns_marquee

function populate(){
        if (iedom){
                cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
                cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
                cross_marquee.innerHTML=marqueecontent
                actualheight=cross_marquee.offsetHeight
        }
        else if (document.layers){
                ns_marquee=document.ns_marquee.document.ns_marquee2
                ns_marquee.top=parseInt(marqueeheight)+8
                ns_marquee.document.write(marqueecontent)
                ns_marquee.document.close()
                actualheight=ns_marquee.document.height
        }
        lefttime=setInterval("scrollmarquee()",scrollinterval)
}
window.onload=populate

function scrollmarquee(){
        if (iedom){
                if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8)) {
                        cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px"
                }
                else {
                        cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
                }
        }
        else if (document.layers){
                if (ns_marquee.top>(actualheight*(-1)+8)) {
                        ns_marquee.top-=copyspeed
                }
                else {
                        ns_marquee.top=parseInt(marqueeheight)+8
                }
        }
}
function scrolldown(){
copyspeed=marqueespeed-3;

}
function scrolldoubleup(){
copyspeed=marqueespeed+3;

}
var txt='';
if (iedom||document.layers){
        with (document){
                if (iedom){
                        txt+='<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'
                        txt+='<div id="iemarquee" style="position:absolute;left:0px;top:0px;width:100%;">'
                        txt+='</div></div>'
                }
                else if (document.layers){
                        txt+='<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee">'
                        txt+='<layer name="ns_marquee2" width='+marqueewidth+' height='+marqueeheight+' left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'
                        txt+='</ilayer>'
                }
        }
}
}
// Scroll upwards end


// Scroll downwards start
else {
var marqueespeed=-1 // Specify speed (larger is faster 1-10) This is the amount of pixel movement per refresh. 1 is best for smoothness.
marqueespeed=(document.all)? marqueespeed : -1
var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var iedom=document.all||document.getElementById
var actualheight=''
var cross_marquee, ns_marquee

function populate(){
        if (iedom){
                cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
                cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
                cross_marquee.innerHTML=marqueecontent
                actualheight=cross_marquee.offsetHeight
        }
        else if (document.layers){
                ns_marquee=document.ns_marquee.document.ns_marquee2
                ns_marquee.top=parseInt(marqueeheight)+8
                ns_marquee.document.write(marqueecontent)
                ns_marquee.document.close()
                actualheight=ns_marquee.document.height
        }
        lefttime=setInterval("scrollmarquee()",scrollinterval)
}
window.onload=populate

function scrollmarquee(){
        if (iedom){
                if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8)) {
                        cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px"
                }
                else {
                        cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
                }
        }
        else if (document.layers){
                if (ns_marquee.top>(actualheight*(-1)+8)) {
                        ns_marquee.top-=copyspeed
                }
                else {
                        ns_marquee.top=parseInt(marqueeheight)+8
                }
        }
}
function scrollup(){
copyspeed=marqueespeed+3;

}
function scrolldoubledown(){
copyspeed=marqueespeed-3;

}
var txt='';
if (iedom||document.layers){
        with (document){
                if (iedom){
                        txt+='<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'
                        txt+='<div id="iemarquee" style="position:absolute;left:0px;top:0px;width:100%;">'
                        txt+='</div></div>'
                }
                else if (document.layers){
                        txt+='<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee">'
                        txt+='<layer name="ns_marquee2" width='+marqueewidth+' height='+marqueeheight+' left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'
                        txt+='</ilayer>'
                }
        }
}
}
// Scroll downwards end


//-->
</script>

<?

/* Write Table to Screen */

$content = "<script type=\"text/javascript\">document.write(txt);</script>";
//$content .= "<tr><td align=\"center\" colspan=\"6\"bgcolor=\"$bgcolor2\">[ <a href=\"index.php?name=Forums\">".Форум."</a> ]&nbsp;&nbsp;&nbsp;[ <a href=\"index.php?op=modload&name=Forums&file=search\">".Поиск."</a> ]</center></td></tr>";
?>


если я сделаю простую копию то работает только последний, что нужно поменять в нем для независимой работы такого же скролинга на этой же странице с другими данными входными.  

Это сообщение отредактировал(а) Lamer George - 15.6.2006, 13:05
PM MAIL   Вверх
Ivan Kolesnikov
Дата 15.6.2006, 07:10 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Шустрый
*


Профиль
Группа: Участник
Сообщений: 113
Регистрация: 9.3.2005
Где: г. Новокузнецк

Репутация: нет
Всего: 6



kazakru, Java и JavaScript два обсолютно разных языка smile и еще используй кнопку код. 
--------------------
PM MAIL ICQ   Вверх
batigoal
Дата 15.6.2006, 13:07 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Нелетучий Мыш
****


Профиль
Группа: Участник Клуба
Сообщений: 6423
Регистрация: 28.12.2004
Где: Санктъ-Петербургъ

Репутация: 1
Всего: 151



Модератор: перемещено из Java 


--------------------
"Чтобы правильно задать вопрос, нужно знать большую часть ответа" (Р. Шекли)
ЖоржЖЖ
PM WWW   Вверх
kazakru
Дата 15.6.2006, 19:05 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 3
Регистрация: 15.6.2006

Репутация: нет
Всего: нет



понял, буду знать, извините еще раз smile
но вопрос актуален до сих пор... 
PM MAIL   Вверх
  
Ответ в темуСоздание новой темы Создание опроса
Форум для вопросов, которые имеются в справочниках, но их поиск вызвал затруднения, или для разработчика требуется совет или просьба отыскать ошибку. Напоминаем: 1) чётко формулируйте вопрос, 2) приведите пример того, что уже сделано, 3) укажите явно, нужен работающий пример или подсказка о том, где найти информацию.
 
0 Пользователей читают эту тему (0 Гостей и 0 Скрытых Пользователей)
0 Пользователей:
« Предыдущая тема | JavaScript: Общие вопросы | Следующая тема »


 




[ Время генерации скрипта: 0.2059 ]   [ Использовано запросов: 22 ]   [ GZIP включён ]


Реклама на сайте     Информационное спонсорство

 
По вопросам размещения рекламы пишите на vladimir(sobaka)vingrad.ru
Отказ от ответственности     Powered by Invision Power Board(R) 1.3 © 2003  IPS, Inc.