SoFunction
Updated on 2025-04-10

Code to control iframe scrolling with javascript

Now there is a horizontal IFRAME. You need to scroll horizontally a html page in the iframe by clicking on an image outside the iframe, but you don’t want to see the scrollbar of the iframe. How to solve it????

<img   src=""   onmousedown="=setInterval('++',10)"   onmouseup="clearInterval()">   
  <img   src=""   onmousedown="=setInterval('--',10)"   onmouseup="clearInterval()">   
  <iframe   name=a   src=""   scrolling=no></iframe>   

 

   

  <iframe   name="in"   src=""></iframe>   
  <div   align="center"   style="height:130px;width:243px;">     
      <script>var   timer;</script>   
      <br>   
      <input   type="button"   value="up"   
  onmousedown="timer1=setInterval('[\'in\'].scrollBy(0,-1)',10)"     
  onmouseup="clearInterval(timer1)">   
      <input   type="button"   value="down"     
  onmousedown="timer1=setInterval('[\'in\'].scrollBy(0,1)',10)"   
  onmouseup="clearInterval(timer1)"   >   
  </div>   

    
     

  <br>0<br>0<br>0<br>0<br>0<br>0<br>0<br>0<br>0<br>0<br>0<br>0<br>0<br>0<br>0<br>0<

 

Scroll horizontally...

     

  <iframe   name="in"   src=""></iframe>   
  <div   align="center"   style="height:130px;width:243px;">     
      <script>var   timer;</script>   
      <br>   
      <input   type="button"   value="Left"   
  onmousedown="timer1=setInterval('[\'in\'].scrollBy(-1,0)',10)"     
  onmouseup="clearInterval(timer1)">   
      <input   type="button"   value="Right"     
  onmousedown="timer1=setInterval('[\'in\'].scrollBy(1,0)',10)"   
  onmouseup="clearInterval(timer1)"   >   
  </div>   

    
     

  <body   scroll=no>