第一步:把如下代码加入到<head>区域中
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function verScroll(dir, spd, loop) {
loop = true
direction = "up"
speed = 10
scrolltimer = null
if (document.layers) {
var page = eval(document.contentLayer)
}
else {
if (document.getElementById) {
var page= eval("document.getElementById( contentLayer ).style")
}
else {
if (document.all) {
var page = eval(document.all.contentLayer.style)
}
}
}
direction = dir
speed = parseInt(spd)
var y_pos = parseInt(page.top)
if (loop == true) {
if (direction == "dn") {
page.top = (y_pos - (speed))
} else {
if (direction == "up" &&y_pos <10) {
page.top = (y_pos + (speed))
} else {
if (direction == "top") {
page.top = 10
}
}
}
scrolltimer = setTimeout("verScroll(direction,speed)", 1)
}
}
function stopScroll() {
loop = false
clearTimeout(scrolltimer)
}
// End -->
</script>
第二步:把如下代码加入到<body>区域中
<div id="contentLayer" style="position:absolutewidth:300pxz-index:1left: 39pxtop: 51px">
aaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbb
ccccccccccccccccccccccccc
ddddddddddddddddddddddddd
eeeeeeeeeeeeeeeeeeeeeeeee
rrrrrrrrrrrrrrrrrrrrrrrr
ffffffffffffffffffffffg
ggggggggggggggggggggggggg
hhhhhhhhhhhhhhhhhhhhhhhhe
eeeeeeeeeeeeeeeeeeeeeee
</div>
<div id="scrollmenu" style="position:absolutewidth:236pxheight:30pxz-index:1left:328pxtop: 44px">
<table border=1><tr><td>
<table>
<tr>
<td align=left>Up</td>
<td></td>
<td align=right>Down</td>
</tr>
<tr>
<td colspan=3>
<a href="#" onMouseOver="verScroll( up , 25 , true )" onMouseOut="stopScroll()"><<<</a>
<a href="#" onMouseOver="verScroll( up , 5 , true )" onMouseOut="stopScroll()"><<</a>
<a href="#" onMouseOver="verScroll( up , 1 , true )" onMouseOut="stopScroll()"><</a>|
<a href="#" onMouseOver="verScroll( dn , 1 , true )" onMouseOut="stopScroll()">></a>
<a href="#" onMouseOver="verScroll( dn , 5 , true )" onMouseOut="stopScroll()">>></a>
<a href="#" onMouseOver="verScroll( dn , 25 , true )" onMouseOut="stopScroll()">>>></a>
</td>
</tr>
</table>
</td></tr></table>
</div>
因项目需要d框显示信息,由于信息过多导致表格很难看,网上查到可以设置单元格自适应高度,设置一个最大高度,当达到最大高度后将显示滚动条,弥补了单元格过度膨胀带来的困扰!单元格自适应高度是在单元格中内嵌div,即<td><div></div></td>
通过设置div达到自适应高度,最大高度后显示滚动条的效果。
样式设置:style="overflow-y:scrollmax-height:130px"
提示成功 layer:
参数说明:1、overflow-y
:
设置当对象的内容超过其指定高度时如何管理内容;overflow-x
:
设置当对象的内容超过其指定宽度时如何管理内容。
参数:
visible:扩大面积以显示所有内容
auto:仅当内容超出限定值时添加滚动条
hidden:总是隐藏滚动条
scroll:总是显示滚动条
2、height
:
设置滚动条的高度(修改其后数值即可)。
3、滚动条颜色参数设置:
scrollbar-3d-light-color
设置或检索滚动条亮边框颜色
scrollbar-highlight-color
设置或检索滚动条3D界面的亮边(ThreedHighlight)颜色
scrollbar-face-color
设置或检索滚动条3D表面(ThreedFace)的颜色
scrollbar-arrow-color
设置或检索滚动条方向箭头的颜色
scrollbar-shadow-color
设置或检索滚动条3D界面的暗边(ThreedShadow)颜色
scrollbar-dark-shadow-color
设置或检索滚动条暗边框(ThreedDarkShadow)颜色
scrollbar-base-color
设置或检索滚动条基准颜色
overflow-x
function
abc()
{
var
div
=
document.getElementById("Layer3")
div.style.overflow-x=0
}
试试吧
对滚动条我还真没用过
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)