TOP /その他のJavaScript スクロールバー









<script type="text/javascript"><!--
flag=0;
var temp,set_y;
bar_y=15;d_flag=0;

function idou(updown){
if(!flag)return;
if(updown)temp=updown;
if(temp=="down" && bar_y < 55)
  bar_y++;
if(temp=="up" && bar_y > 15)
  bar_y--;
document.bar.style.top=bar_y;
window.slide.scroll(0,(bar_y - 15)*4);
setTimeout("idou()", 10);
}

function idou2(){
d_y=document.bar.style.pixelTop;
y=document.getElementById("base").style.pixelTop;
w_y=document.body.scrollTop;
if((d_y + y) < (event.y + w_y))
    bar_y+=20;
else
    bar_y-=20;
  if(bar_y > 55)bar_y =55;
  if(bar_y < 15)bar_y =15;
document.bar.style.top=bar_y;
window.slide.scroll(0,(bar_y - 15)*4);
}

function d_down(){
d_flag=1;
d_y=document.bar.style.pixelTop;
set_y=(d_y-event.y);
}

function d_move(){
if(!d_flag)return;
bar_y=event.y+set_y;
  if(bar_y > 55)bar_y =55;
  if(bar_y < 15)bar_y =15;
document.bar.style.top=bar_y;
window.slide.scroll(0,(bar_y - 15)*4);
}/*himajin.moo.jp*/
// --></script>
<div id="base"style="position:absolute;top:50px; left:10px;" onmouseup="d_flag=0;"onmousemove="d_move();return false;">
<IFRAME name="slide"src = "iframe.html" height=120 width=300 frameborder=0></IFRAME>
<img src="base.gif" border=0 style="position:absolute; top:15px; left:300px;height:90; width:15;"onmousedown="idou2()">
<img src="up.gif" border=0 style="position:absolute; top:0px; left:300px;height:15; width:15;"onmousedown="flag=1;idou('up');"onmouseup="flag=0">
<img src="down.gif" border=0 style="position:absolute; top:105px; left:300px;height:15; width:15;"onmousedown="flag=1;idou('down');"onmouseup="flag=0">
<img name="bar"src="slide.gif" border=0 style="position:absolute; top:15px; left:300px;height:50; width:15;"onmousedown="d_down()"onmouseout="d_flag=0;">
</div>