用javascript控制iframe滾動(dòng)的代碼
更新時(shí)間:2007年04月10日 00:00:00 作者:
現(xiàn)在有一個(gè)橫向的IFRAME,需要通過點(diǎn)擊iframe外的一個(gè)圖片來橫向滾動(dòng)iframe內(nèi)的一個(gè)html頁,但又不想讓看見iframe的滾動(dòng)條,請問如何解決啊????
<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<
橫向滾動(dòng)..
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<
橫向滾動(dòng)..
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>
相關(guān)文章
defer屬性導(dǎo)致引用JQuery的頁面報(bào)“瀏覽器無法打開網(wǎng)站xxx,操作被中止”錯(cuò)誤的解決方法
defer屬性導(dǎo)致引用JQuery的頁面報(bào)“瀏覽器無法打開網(wǎng)站xxx,操作被中止”錯(cuò)誤2010-04-04
javaScript+turn.js實(shí)現(xiàn)圖書翻頁效果實(shí)例代碼
這篇文章主要介紹了javaScript+turn.js實(shí)現(xiàn)圖書翻頁效果實(shí)例代碼,重點(diǎn)講解turn.js 如何使用的。需要的朋友可以參考下2017-02-02
Webpack打包c(diǎn)ss后z-index被重新計(jì)算的解決方法
這篇文章主要跟大家分享了Webpack打包c(diǎn)ss后z-index被重新計(jì)算的解決方法,文中介紹的非常詳細(xì),對大家具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面跟著小編一起來學(xué)習(xí)學(xué)習(xí)吧。2017-06-06
JavaScript實(shí)現(xiàn)簡單的拖拽效果
這篇文章主要為大家詳細(xì)介紹了JavaScript實(shí)現(xiàn)簡單的拖拽效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2021-11-11

