# Scrolling a div

**URL:** <https://forum.kirupa.com/t/scrolling-a-div/205832>\
**Category:** Uncategorized\
**Created:** [November 2, 2006, 12:38pm UTC](https://forum.kirupa.com/t/scrolling-a-div/205832 "2006-11-02T12:38:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Binji](https://avatars.discourse-cdn.com/v4/letter/b/cdc98d/32.png) [@Binji](https://forum.kirupa.com/u/Binji)\
**Post date:** [November 2, 2006, 12:38pm UTC](https://forum.kirupa.com/t/scrolling-a-div/205832/1 "2006-11-02T12:38:54Z")

</div>

I would like to create two links which act as a scroll-up and scroll-down commands for a div. At the moment this is what i tried:  
HTML

```auto

<div id="scroll">
    <a href=# onmouseover="javascript:scroll(tekst, -50)" onmouseout="stopscroll()" ><img src="images/p_gor.png" /></a>
    <a href=# onmouseover="javascript:scroll(tekst, 50)" onmouseout="stopscroll()" ><img src="images/p_dol.png"/></a>

```

JavaScript

```auto

function scroll(objekt, kol){
        objekt.scrollBy(0,kol);
        scrollDelay = setTimeout('scroll', 100);
}

function stopScroll(){
    clearTimeout(scrollDelay);    
}

```

but i dont know how to reference a div as an object to be scrolled. I tried calling it by using a CSS id and giving it a name but nothing worked.  
Any suggestions?
