当前位置: 首页 > 图文教程 > 网络编程 > Javascript > 用javascript控制iframe滚动的代码

Javascript
用new Image()预先加载图片真的有用吗?
超级susymenu实现top菜单
新版本susymenu树形菜单,请大家指教、分享
javascript入门·图片对象(无刷新变换图片)\滚动图像
国外Lightbox v2.03.3 最新版 下载
javascript渐变显示的雅虎中国选项卡效果代码
用javascript来实现select标签的美化的代码
用javascript实现改善用户体验之alert提示效果
Auntion-TableSort javascript类文件
javascript 新闻切换技术
JS代码判断集锦大全
[原创]用javascript实现检测指定目录是否存在的方法
JavaScript中的其他对象
[原创]来自ImageSee官方 JavaScript图片浏览器
用js 让图片在 div或dl里 居中,底部对齐
网页代码常用小技巧总结
可以自动轮换的页签 tabs with auto play fucntion
js判断一点是否在一个三角形内
DHTML Slide Show script图片轮换
JS event使用方法详解

Javascript 中的 用javascript控制iframe滚动的代码


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-10-12   浏览: 224 ::
收藏到网摘: n/a

现在有一个横向的IFRAME,需要通过点击iframe外的一个图片来横向滚动iframe内的一个html页,但又不想让看见iframe的滚动条,请问如何解决啊????
<img src="demo.gif" onmousedown="window.timer=setInterval('a.document.body.scrollTop++',10)" onmouseup="clearInterval(window.timer)">
<img src="demo.gif" onmousedown="window.timer=setInterval('a.document.body.scrollTop--',10)" onmouseup="clearInterval(window.timer)">
<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<

横向滚动..
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>