Code for controlling iframe scrolling using javascript

Source: Internet
Author: User

Now there is a horizontal IFRAME. You need to click an image outside the iframe to scroll a html page in the iframe horizontally, but you do not want to see the iframe scroll bar, how can this problem be solved ????



<Iframe name = a src = "test.html" scrolling = no> </iframe>

Demo.htm

<Iframe name = "in" src = "in.htm"> </iframe>
<Div align = "center" style = "height: 130px; width: 243px;">
<Script> var timer; </script>
<Br>
<Input type = "button" value = "up"
Onmousedown = "timer1 = setInterval ('parent. frames [\ 'In \ ']. scrollBy (0,-1)', 10 )"
Onmouseup = "clearInterval (timer1)">
<Input type = "button" value = "down"
Onmousedown = "timer1 = setInterval ('parent. frames [\ 'In \ ']. scrollBy (0, 1)', 10 )"
Onmouseup = "clearInterval (timer1)">
</Div>

In.htm

<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 ..

Demox.htm

<Iframe name = "in" src = "inx.htm"> </iframe>
<Div align = "center" style = "height: 130px; width: 243px;">
<Script> var timer; </script>
<Br>
<Input type = "button" value = "Left"
Onmousedown = "timer1 = setInterval ('parent. frames [\ 'In \ ']. scrollBy (-1, 0)', 10 )"
Onmouseup = "clearInterval (timer1)">
<Input type = "button" value = "Right"
Onmousedown = "timer1 = setInterval ('parent. frames [\ 'In \ ']. scrollBy (1, 0)', 10 )"
Onmouseup = "clearInterval (timer1)">
</Div>

Inx.htm

<Body scroll = no>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.