求一个javascript做的页面滚动按钮,上下能滚动就够了。 一个按钮啊,按一下,滚一点,应该是:window.scrollTo(0,window.xxxtop+10)这样 才对吧,否则不能叫滚动条呀,望指教。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title></title><style type="text/css">.button { background: ButtonFace; border: 1px solid ButtonShadow; border-left: 0; border-right: 0;}.scrollButton { font-family: Webdings; color: blue; text-align: center; cursor: hand;}#scrollContainer { height: 100%; overflow: hidden; padding: 0px;}.border { border-left: 1px solid ButtonShadow; border-right: 1px solid ButtonShadow; width: 200px;}</style></head><script language="javascript">/*功能:滚动*/function ScrollButton( oEl, oScrollContainer, nDir ) { this.htmlElement = oEl; this.scrollContainer = oScrollContainer; this.dir = nDir; var oThis = this; oEl.onmouseover=function(){oThis.startScroll()} //捕作事件 oEl.onmouseout=function(){oThis.endScroll()}}ScrollButton.scrollIntervalPause = 100;ScrollButton.scrollAmount = 18;ScrollButton.prototype.startScroll = function () { var oThis = this; this._interval = window.setInterval( function () { switch ( oThis.dir ) { case 8: oThis.scrollContainer.scrollTop -= ScrollButton.scrollAmount; break; case 2: oThis.scrollContainer.scrollTop += ScrollButton.scrollAmount; break; case 4: oThis.scrollContainer.scrollLeft -= ScrollButton.scrollAmount; break; case 6: oThis.scrollContainer.scrollLeft += ScrollButton.scrollAmount; break; } }, ScrollButton.scrollIntervalPause );};ScrollButton.prototype.endScroll = function () { if ( this._interval != null ) { window.clearInterval( this._interval ); //结束滚动 this._interval=null; }};</script><body id="bdy" topmargin="0" leftmargin="0" scroll="no" onselectstart="javascript:return false" ondragstart="javascript:return false" oncontextmenu="javascript:return false"><center><table align="center" width="100%" height="100%" border=0><tr><td align="center" rowspan=2><div id="scrollContainer">在这个层里添加你的内容!其他的地方不动!<br><br><Br>在这个层里添加你的内容!其他的地方不动!<br><br><Br>在这个层里添加你的内容!其他的地方不动!<br><br><Br>在这个层里添加你的内容!其他的地方不动!<br><br><Br>在这个层里添加你的内容!其他的地方不动!<br><br><Br>在这个层里添加你的内容!其他的地方不动!<br><br><Br>在这个层里添加你的内容!其他的地方不动!<br><br><Br>在这个层里添加你的内容!其他的地方不动!<br><br><Br>在这个层里添加你的内容!其他的地方不动!<br><br><Br> </div> </td> <td width=16 valign="top"> <div class="scrollButton" id="upScrollButton">5</div> </td> </tr> <tr><td width=16 valign="bottom"> <div class="scrollButton" id="downScrollButton">6</div> </td></tr> </table><script type="text/javascript">ScrollButton.scrollIntervalPause = 50; //ScrollButton.scrollAmount = 5;var upScrollButton = document.getElementById( "upScrollButton" );var downScrollButton = document.getElementById( "downScrollButton" );var scrollContainer = document.getElementById( "scrollContainer" );//var bodyObj=document.getElementById( "body" );new ScrollButton( upScrollButton, scrollContainer, 8 );new ScrollButton( downScrollButton, scrollContainer, 2 );</script></body></html> js或jquery读取json 关于js中alert窗口关闭的问题 急急急!在线等 简单的两个Dropdownlist的联动 如何做这个按钮 带翻动的滤镜效果的图片如何加热区使其能链接多个URL?(附代码) 有这样一个小程序,求帮我写一下~+100 用户端JSP页面如何禁止刷新? 平板 事件点击 请问如何能动态向一个数组中添加数据,删除数据。谢谢! 请问JavaScript如何调用数据库? 怎样判断浏览器的版本号???? 一个很简单的关于aphache的问题
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title><style type="text/css">.button {
background: ButtonFace;
border: 1px solid ButtonShadow;
border-left: 0;
border-right: 0;
}.scrollButton {
font-family: Webdings;
color: blue;
text-align: center;
cursor: hand;
}#scrollContainer {
height: 100%;
overflow: hidden;
padding: 0px;
}.border {
border-left: 1px solid ButtonShadow;
border-right: 1px solid ButtonShadow;
width: 200px;
}
</style>
</head>
<script language="javascript">
/*
功能:滚动*/
function ScrollButton( oEl, oScrollContainer, nDir ) {
this.htmlElement = oEl;
this.scrollContainer = oScrollContainer;
this.dir = nDir;
var oThis = this;
oEl.onmouseover=function(){oThis.startScroll()} //捕作事件
oEl.onmouseout=function(){oThis.endScroll()}}ScrollButton.scrollIntervalPause = 100;
ScrollButton.scrollAmount = 18;ScrollButton.prototype.startScroll = function () {
var oThis = this;
this._interval = window.setInterval( function () {
switch ( oThis.dir ) {
case 8:
oThis.scrollContainer.scrollTop -= ScrollButton.scrollAmount;
break;
case 2:
oThis.scrollContainer.scrollTop += ScrollButton.scrollAmount;
break;
case 4:
oThis.scrollContainer.scrollLeft -= ScrollButton.scrollAmount;
break;
case 6:
oThis.scrollContainer.scrollLeft += ScrollButton.scrollAmount;
break;
}
}, ScrollButton.scrollIntervalPause );
};ScrollButton.prototype.endScroll = function () {
if ( this._interval != null ) {
window.clearInterval( this._interval ); //结束滚动
this._interval=null;
}
};</script><body id="bdy" topmargin="0" leftmargin="0" scroll="no" onselectstart="javascript:return false" ondragstart="javascript:return false" oncontextmenu="javascript:return false">
<center>
<table align="center" width="100%" height="100%" border=0><tr><td align="center" rowspan=2><div id="scrollContainer">
在这个层里添加你的内容!其他的地方不动!<br><br><Br>
在这个层里添加你的内容!其他的地方不动!<br><br><Br>
在这个层里添加你的内容!其他的地方不动!<br><br><Br>
在这个层里添加你的内容!其他的地方不动!<br><br><Br>
在这个层里添加你的内容!其他的地方不动!<br><br><Br>
在这个层里添加你的内容!其他的地方不动!<br><br><Br>
在这个层里添加你的内容!其他的地方不动!<br><br><Br>
在这个层里添加你的内容!其他的地方不动!<br><br><Br>
在这个层里添加你的内容!其他的地方不动!<br><br><Br>
</div> </td>
<td width=16 valign="top">
<div class="scrollButton" id="upScrollButton">5</div>
</td>
</tr>
<tr><td width=16 valign="bottom">
<div class="scrollButton" id="downScrollButton">6</div>
</td></tr>
</table><script type="text/javascript">ScrollButton.scrollIntervalPause = 50; //
ScrollButton.scrollAmount = 5;var upScrollButton = document.getElementById( "upScrollButton" );
var downScrollButton = document.getElementById( "downScrollButton" );
var scrollContainer = document.getElementById( "scrollContainer" );
//var bodyObj=document.getElementById( "body" );new ScrollButton( upScrollButton, scrollContainer, 8 );
new ScrollButton( downScrollButton, scrollContainer, 2 );</script>
</body>
</html>