分享

JS实现用两个按钮控制水平/垂直区域内容滚动

 weiledream 2011-05-15
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www./TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www./1999/xhtml">
 <head>
  <title>JS实现用两个按钮控制水平/垂直区域内容滚动 - www.</title>
<style type="text/css">
td {font-size: 12px;}
.opacity {COLOR: #4AAAC5; FILTER: alpha(opacity=100)}
.solid-top {BORDER-TOP: #CCCCCC 1px solid}
.solid-right {BORDER-RIGHT: #CCCCCC 1px solid}
.solid-bottom {BORDER-BOTTOM: #CCCCCC 1px solid}
.solid-left {BORDER-LEFT: #CCCCCC 1px solid}
</style>
 </head>
<body>
<table width="510" border="0" align="center" cellpadding="0" cellspacing="0" class="solid-top solid-bottom">
 
  <tr>
    <td width="480"><iframe src="http://www./images/20100906/news-1.htm" name="new_date"
                                width="480" marginwidth="0" height="150"
                                marginheight="0" scrolling="No"
                                frameborder="0" id="new_date" border="0" framespacing="2"
                                noresize="noresize" vspale="0"></iframe></td>
    <td width="30" align="center" valign="top"><br>
        <img src="http://www./images/20100906/scrollup.gif" alt="点住不放可以快速向上滚动"
                                width="11" height="11" vspace="5" class="opacity"
                                onMouseDown="movover();movstar(-3,2)"
                                onMouseUp="movover();movstar(-1,20)"
                                onMouseOver="movstar(-1,20);o_down(this)"
                                onMouseOut="movover();o_up(this)" /><br>
        <img src="http://www./images/20100906/scrolldw.gif" alt="点住不放可以快速向下滚动"
                                width="11" height="11" vspace="5" class="opacity"
                                onMouseDown="movover();movstar(3,2)"
                                onMouseUp="movover();movstar(1,20)"
                                onMouseOver="movstar(1,20);o_down(this)"
                                onMouseOut="movover();o_up(this)" /> <br>
    <script language=JavaScript>
function movstar(a,time){
 movx=setInterval("mov("+a+")",time)
 }
function movover(){
 clearInterval(movx)
 }
function mov(a){
 scrollx=new_date.document.body.scrollLeft
 scrolly=new_date.document.body.scrollTop
 scrolly=scrolly+a
 new_date.window.scroll(scrollx,scrolly)
 }
function o_down(theobject){
object=theobject
 while(object.filters.alpha.opacity>60){
  object.filters.alpha.opacity+=-10}
  }
function o_up(theobject){
object=theobject
 while(object.filters.alpha.opacity<100){
  object.filters.alpha.opacity+=10}
  }
function wback(){
 if(new_date.history.length==0){window.history.back()}
 else{new_date.history.back()}
 }
        </script></td>
  </tr>
</table>
<br>
<br>
<table width="510" height="180" border="0" align="center" cellpadding="0" cellspacing="0" class="solid-left solid-right">
  <tr>
    <td><iframe src="http://www./images/20100906/news-2.htm" name="frm_piclist"
                                width="510" marginwidth="0" height="150"
                                marginheight="0" scrolling="No"
                                frameborder="0" id="frm_piclist" border="0" framespacing="2"
                                noresize="noresize" vspale="0"></iframe></td>
  </tr>
  <tr>
    <td height="30" align="center"><IMG
                  src="http://www./images/20100906/scrolllf.gif" alt="点住不放可以快速向左滚动" width="11" height="11" hspace="5" border=0 class=opacity
                  onmousedown=runover();runstar(-3,2,2)
                  onmouseup=runover();runstar(-1,20,2)
                  onmouseover=runstar(-1,20,2);x_down(this)
                  onmouseout=runover();x_up(this)><IMG
                  src="http://www./images/20100906/scrollrt.gif" alt="点住不放可以快速向右滚动" width="11" height="11" hspace="5" border=0 class=opacity
                  onmousedown=runover();runstar(3,2,2)
                  onmouseup=runover();runstar(1,20,2)
                  onmouseover=runstar(1,20,2);x_down(this)
                  onmouseout=runover();x_up(this)>
    <SCRIPT>
function runstar(a,time,flag){
 if (1 == flag){runx=setInterval("run("+a+")",10)}
 else{runx=setInterval("run2("+a+")",10)}
}
function runover(){
clearInterval(runx)
}
function run(a){
scrollx=frm_frdlist.document.body.scrollLeft
scrolly=frm_frdlist.document.body.scrollTop
scrollx=scrollx+a
frm_frdlist.window.scroll(scrollx,scrolly)
}
function run2(a){
scrollx=frm_piclist.document.body.scrollLeft
scrolly=frm_piclist.document.body.scrollTop
scrollx=scrollx+a
frm_piclist.window.scroll(scrollx,scrolly)
}
function x_down(theobject){
 object=theobject
 
 while(object.filters.alpha.opacity>60){
  object.filters.alpha.opacity+=-10
 }
}
function x_up(theobject){
 object=theobject
 while(object.filters.alpha.opacity<60){
  object.filters.alpha.opacity+=10
 }
}
function wback(){
 if(frm_frdlist.history.length==0){window.history.back()}
 else{frm_frdlist.history.back()}
}
      </SCRIPT></td>
  </tr>
</table>
<br />
<p><a href="http://www.">网页代码站</a> - 最专业的代码下载网站 - 致力为中国站长提供有质量的代码!</p>
</body>
</html>

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约