Создать форум бесплатно: ixbb.ru :: Календарь на Апрель 2024 года: calendar2008.ru/2024/aprel/

  Reply to this topicStart new topicStart Poll

Помогите со скриптом

, немогу разобраться
Xoxol000
Отправлено: Jan 7 2011, 03:36 AM
Quote Post


  Сержант
*

Группа: Members
Сообщений: 23
Пользователь №: 3677
Регистрация:
7-January 11



Помогите плиз скрипт переделать!!!

Есть страничка со скриптом она выводит менюшку с перелистыванием строк вот сам файл


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Вертикальное меню в слое Прокрутка вверх-низ линками и возможностью показа всего меню</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1251">
<style type="text/css">
<!--
/*ширина рамка*/
#mContainer {
position:relative;
width:500px;
height:auto;
margin:auto;
border:2px solid #000;
overflow:hidden;
}
/*Ширина текстового поля в нутри рамки*/
#nContainer {
position:relative;
overflow:hidden;
width:600px;
border-style:none;
background:#D8D8D8;
}
#listContainer {
display:block;
position:absolute;
top:0px;
left:0px;
width:400px;
padding:0px;
margin:0px;
}
/*Ширина ссылки*/
#listContainer li {
position:relative;
display:block;
border-style:none;
width:500px;
height:10px;
padding:2px;
font:9px verdana;
cursor:pointer;
margin:0px;
color:#638DA1;
background-color:#D8D8D8;
line-height:10px;
}
#listContainer>li {
border-top:1px solid #311DF2; /* #638DA1; */
}
#listContainer li:hover {
color:#000;
}
/*Ширина кнопок*/
#upArrow,#downArrow {
width:500px;
height:10px;
font:9px verdana;;
text-align:center;
color:#FFF;
cursor:pointer;
}
/*Поле с кнопкой вверх*/
#upArrow {
background:#311DF2 url(up.gif) no-repeat center center;
}
/*Поле с кнопкой вниз*/
#downArrow {
background:#311DF2 url(down.gif) no-repeat center center;
}
/*Размер нижнего поля*/
#changeSize {
width:50px;
height:50px;
position:relative;
float:right;
background:#311DF2 url(plus.gif) no-repeat center center;
}
-->
</style>
<script type="text/javascript">
<!--
window.onload=init;
var d=document;
var expander; // object reference for the plus/minus div
var lContainer; // object reference for the UL
var currentTop=0; // the current Y position of the UL
var zInterval = null; // animation thread interval
var direction; // direction we're scrolling the UL. 0==up, 1==down
var startTop=0; // the starting top of the UL
var scrollRate=6; // initial rate of scrolling
var scrollTick=0; // keeps track of long we've scrolled so we can slow it down accordingly
var listExpand=true; // boolean to tell us if we're expanding or contracting the list
var listHeight=60; // the current height of the UL
var isExpanded=false; // boolean to denote if the list is expanded or not. initiliazed to true as it will be set to false as soon as the expand control is clicked.
var MAX_SCROLL_TICK=4; // the maximum value of scrollTick before it's reset
var LI_PADDING=2; // the LI's padding value. used to compensate for overall dimensions
var LI_HEIGHT=10; // the height of the LI
var MAX_LIST_HEIGHT=300; // maximum height of the list when fully expanded
var MIN_LIST_HEIGHT=60; // contracted height of the list
var REBOUND = -4; // the value of scrollRate when we stop scrolling
var FAST_EXPAND=5; // the initial rate of list expansion
var SLOW_EXPAND=1; // the end rate of expansion
var SPEED_TRANSITION=20; // when this value + the MAX or MIN list height is reached, we set scrollRate to its slower rate
function init() {
if(!d.getElementById)return; // bail out if this is an older browser
up=d.getElementById("upArrow");
down=d.getElementById("downArrow");
down.onclick=function(){scrollObjects(0);}
up.onclick=function(){scrollObjects(1);}
expander=d.getElementById("changeSize");
expander.onclick=function(){if(!isExpanded)isExpanded=true;changeListSize(); }
lContainer = d.getElementById("listContainer");
d.getElementById("nContainer").style.height=MIN_LIST_HEIGHT+"px";
}
function scrollObjects(dir) {
if(zInterval)return; // already scrolling.
if(isExpanded)return; // list is expanded. no need to scroll.
if((!dir && currentTop<=-240) || (dir && currentTop==0))return; // dont scroll up if we're at the top or down if at the bottom of the list
direction=dir;
zInterval=setInterval("animate()",20);
}
function animate() {
if(!direction) {
currentTop-=scrollRate;
} else {
currentTop+=scrollRate;
}
scrollTick++;
if(scrollTick>=MAX_SCROLL_TICK) {
scrollRate--; // slow the scroll rate down for a little style
scrollTick=0;
}
lContainer.style.top=currentTop+"px";
if(scrollRate<=REBOUND) {
clearInterval(zInterval);
zInterval=null;
startTop=currentTop;
scrollTick=0;
scrollRate=6;
}}
function changeListSize() {
listExpand=listExpand?false:true;
clearInterval(zInterval);
zInterval=setInterval("expandList()",20);
}
function expandList() {
if(!listExpand) {
if(listHeight<MAX_LIST_HEIGHT-SPEED_TRANSITION) {
listHeight+=FAST_EXPAND;
} else {
listHeight+=SLOW_EXPAND;
}
if(currentTop<0) {
currentTop+=3;
lContainer.style.top=currentTop+"px";
}
if(listHeight<MAX_LIST_HEIGHT)document.getElementById("nContainer").style.height=listHeight+"px";

if(listHeight>=MAX_LIST_HEIGHT && currentTop>=0) {
clearInterval(zInterval);
zInterval=null;
expander.style.backgroundImage="url(minus.gif)";
currentTop=0;
isExpanded=true;
}
} else {
if(listHeight>MIN_LIST_HEIGHT+SPEED_TRANSITION) {
listHeight-=FAST_EXPAND;
} else {
listHeight-=SLOW_EXPAND;
}
document.getElementById("nContainer").style.height=listHeight+"px";
if(listHeight<=MIN_LIST_HEIGHT) {
clearInterval(zInterval);
zInterval=null;
expander.style.backgroundImage="url(plus.gif)";
isExpanded=false;
} }}
// -->
<!-- SE@RCHER Javascript www.03www.su 2009 год --></script>
</head>
<body>
<div id="mContainer">
<div id="upArrow"></div>
<div id="nContainer">
<ul id="listContainer">
<li>List Item 1</li>
<li>List Item 2</li>
<li>List Item 3</li>
<li>List Item 4</li>
<li>List Item 5</li>
<li>List Item 6</li>
<li>List Item 7</li>
<li>List Item 8</li>
<li>List Item 9</li>
<li>List Item 10</li>
<li>List Item 11</li>
<li>List Item 12</li>
<li>List Item 13</li>
<li>List Item 14</li>
<li>List Item 15</li>
<li>List Item 16</li>
<li>List Item 17</li>
<li>List Item 18</li>
<li>List Item 19</li>
<li>List Item 20</li>
</ul>
</div>
<div id="downArrow">
<div id="changeSize"></div>
</div>
</div>
</body>
</html>


Нужно сделать так чтоб этот скрапт делал тоже самое только с внешнего файла. Внешний файл хочу сделать js и вывисти все <li></li> через

document.write('<li>List Item 20</li>');

помогите плиз оч нужно
PMEmail Poster
Top
Ilidan
Отправлено: Jan 7 2011, 11:15 AM
Quote Post


  Команда ЭйсВэб
*

Группа: Super moderator
Сообщений: 940
Пользователь №: 508
Регистрация:
30-March 07



Ну дак в чем проблема?) Сделай внешний файл да подключи. Что именно не получается?


--------------------
;-)
PMEmail PosterICQAOL
Top

Topic Options Reply to this topicStart new topicStart Poll

 



[ Script Execution time: 0.0219 ]   [ 10 queries used ]   [ GZIP выключен ]