用javascript控制iframe滚动的代码
2007-04-10 00:00
405 查看
现在有一个横向的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>
<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>
相关文章推荐
- 用javascript控制iframe滚动的代码
- JavaScript控制图片横向滚动代码
- javascript控制frame,iframe的src属性代码
- javascript控制frame,iframe的src属性代码
- 用javascript控制iframe滚动
- 网页制作--滚动新闻代码(用iframe即时更新网上的新闻)
- 用javascript 控制表格行的展开和隐藏的代码
- 用javascript代替marquee的滚动字幕效果代码
- javascript控制图片滚动
- JavaScript控制图片360度旋转代码
- JavaScript控制图片360度旋转代码
- JavaScript控制图片360度旋转代码
- Javascript刷新本页面、父页面、iframe、定时刷新的代码
- 使用iframe window的scroll方法控制iframe页面滚动
- 用javascript代替marquee的滚动字幕效果代码
- 添加浮动按钮点击滚动到网页底部的纯JavaScript演示代码 IE9、11,Maxthon 1.6.7,Firefox30、31,360极速浏览器7.5.3.308下测试正常
- JavaScript 滚动条示例,控制居中document.documentElement.scrollTop,document.body.scrollTop,oDiv.offsetHeight
- 史上最全的js/jquery/javascript控制input输入框输入格式的代码
- Javascript 实现全屏滚动实例代码
- javascript 控制iframe