# Scrolling an IFRAME sideways with (java)Script

**URL:** <https://forum.kirupa.com/t/scrolling-an-iframe-sideways-with-java-script/200306>\
**Category:** web dev\
**Created:** [September 11, 2006, 10:44am UTC](https://forum.kirupa.com/t/scrolling-an-iframe-sideways-with-java-script/200306 "2006-09-11T10:44:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ericinho](https://avatars.discourse-cdn.com/v4/letter/e/9dc877/32.png) [@ericinho](https://forum.kirupa.com/u/ericinho)\
**Post date:** [September 11, 2006, 10:44am UTC](https://forum.kirupa.com/t/scrolling-an-iframe-sideways-with-java-script/200306/1 "2006-09-11T10:44:02Z")

</div>

Hello,

I would like to scroll the content of an IFRAME sideways instead of up and down.

The up and down version I figured out, but how can i adjust the existing script to make it scroll from left to right and vice versa untill it reaches the end of the div or table?

```auto

<script type="text/javascript">

var timer_id;
function scroll_iframe(frm,inc,dir) {
  if (timer_id) clearTimeout(timer_id);
  if (window.frames[frm]) {
    if (dir == "v") window.frames[frm].scrollBy(0, inc);
    else window.frames[frm].scrollBy(inc, 0);
    timer_id = setTimeout("scroll_iframe('" + frm + "'," + inc + ",'" + dir + "')", 20);
  }
}

function stopScroll() { if (timer_id) clearTimeout(timer_id); }
</script>

```

and then the button script:

```auto
<a href="javascript:;" onmouseover="scroll_iframe('scr1', -4, 'v'); window.status='Up.'; return true" onmouseout="stopScroll(); window.status=''; return true">

```

and

```auto
<a href="javascript:;" onmouseover="scroll_iframe('scr1', 4, 'v'); window.status='Down.'; return true" onmouseout="stopScroll(); window.status=''; return true">

```

Thanks!
