Insert title here
.category_list{width:200px;border:solid 1px #666666;height:300px;position:relative;}
#category_list{list-style:none;margin:0;padding:0;padding-left:20px;overflow:hidden;height:298px;}
#category_scroll{height:298px;width:15px;border:green solid 1px;position:absolute;right:0;top:0;font-size:12px;cursor:hand;}
#scrollup{height:15px;width:15px;border:green solid 1px;}
#scroll_hand{height:100px;width:15px;border:green solid 1px;position:absolute;}
#scrolldown{height:15px;width:15px;border:green solid 1px;position:absolute;bottom:0;}
1something
2something
3something
4something
5something
6something
7something
8something
9something
10something
11something
12something
13something
14something
15something
16something
17something
18something
19something
20something
21something
22something
23something
24something
25something
26something
27something
28something
29something
30something
上
滚动滚动滚动
下
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]现在有个问题就是当点中滚动条后,触发键盘的上下键,来控制上下滚动。然而,一般情况下,键盘事件似乎只针对Form表单对象和Winsow窗体对象起作用(除IE),那么当创建事件处理函数时该怎们写呢? oEventUtil.addEventHandler(category_hand,"keyup",test),似乎是不行,毕竟category_hand代表的是一个DIV test()函数如下: function test(){ //alert("RUN"); var oEvent = oEventUtil.getEvent(); if(oEvent.keyCode==38){ alert("UP"); clickNarrowup(); } if(oEvent.keyCode==40){ clickNarrowdown(); alert("DOWN"); } } 请高手帮忙解答一下。 疑问二:这段代码中,在定义变量的时候我是在HTML中间插入的代码,用于获取对象,如果这段代码插入到window.onload函数中时,那么很有可能此时这些对象尚未加载,无法读取到而产生程序错误,那么问题就是,如果我想完全将: <script type="text/javascript"> var category_scroll = document.getElementById("category_scroll"); var scroll_hand = document.getElementById("scroll_hand"); var scrollup = document.getElementById("scrollup"); var scrolldown = document.getElementById("scrolldown"); var category_list = document.getElementById("category_list"); </script> 引入到<head>之间怎们处理比较好呢?blueidea版主给出的解决方法
推荐阅读
实例区别onClick和onDBClick两事件方法
html-
test
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]>>>详细阅读
本文标题:Javascript模拟scroll滚动效果脚本第1/2页
地址:http://www.17bianji.com/kaifa2/JS/29389.html
1/2 1