Click to See Complete Forum and Search --> : How to vertically scroll 2-col-Tables per DHTML?
drac0nix
11-01-2007, 03:16 PM
Hey, I found this piece of code on the net:
http://www.dyn-web.com/dhtml/scroll/
especially http://www.dyn-web.com/dhtml/scroll/glide-scroll-rel-v.html
Well, this one scrolls a table, but
1.) views only one element at a time
2.) scrolls only one column
3.) only images !
Is it possible to change that? What I want to accomplish essentially is vertically scrolling a table, that will become longer/higher as content is added, but I don't want to use browser-scrollbars. Instead of those, I'd rather those buttons. What to do?
vertically scrolling a table, that will become longer/higher as content is added
This is an unclear statement. If you're employing a scroll, the table's dimensions should remain static. :confused:
So, are you wanting the area's dimensions to be static or dynamic?
drac0nix
11-02-2007, 09:59 AM
Static of course. I just implied that the "area" might grow in size with time, but as it's a static document, that shouldn't be a problem.
harumph
11-02-2007, 11:33 AM
Someone had a similar request recently. I can't find the post, now. But here's an example:
<style type="text/css">
#divUpControl{
position:absolute;
width:66px;
left:510px;
top:40px;
z-index:1;
text-align: right;
height: 19px;
}
#divDownControl{
position:absolute;
width:82px;
left:500px;
top:233px;
z-index:1;
text-align: right;
height: 19px;
}
#divContainer{position:absolute; width:502px; height:240px; overflow:hidden; top:30; left:10; clip:rect(0 505 240 0); visibility:visible}
#divContent{position:absolute; top:0; left:0}
</style>
<script language="JavaScript">// begin absolutely positioned scrollable area object scripts
// Extension developed by David G. Miles
// Original Scrollable Area code developed by Thomas Brattli
function verifyCompatibleBrowser(){
this.ver=navigator.appVersion
this.dom=document.getElementById?1:0
this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
this.ie4=(document.all && !this.dom)?1:0;
this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
this.ns4=(document.layers && !this.dom)?1:0;
this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
return this
}
bw=new verifyCompatibleBrowser()
var speed=50
var loop, timer
function ConstructObject(obj,nest){
nest=(!nest) ? '':'document.'+nest+'.'
this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight
this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight
this.up=MoveAreaUp;this.down=MoveAreaDown;
this.MoveArea=MoveArea; this.x; this.y;
this.obj = obj + "Object"
eval(this.obj + "=this")
return this
}
function MoveArea(x,y){
this.x=x;this.y=y
this.css.left=this.x
this.css.top=this.y
}
function MoveAreaDown(move){
if(this.y>-this.scrollHeight+objContainer.clipHeight){
this.MoveArea(0,this.y-move)
if(loop) setTimeout(this.obj+".down("+move+")",speed)
}
}
function MoveAreaUp(move){
if(this.y<0){
this.MoveArea(0,this.y-move)
if(loop) setTimeout(this.obj+".up("+move+")",speed)
}
}
function PerformScroll(speed){
if(initialised){
loop=true;
if(speed>0) objScroller.down(speed)
else objScroller.up(speed)
}
}
function CeaseScroll(){
loop=false
if(timer) clearTimeout(timer)
}
var initialised;
function InitialiseScrollableArea(){
objContainer=new ConstructObject('divContainer')
objScroller=new ConstructObject('divContent','divContainer')
objScroller.MoveArea(0,0)
objContainer.css.visibility='visible'
initialised=true;
}
// end absolutely positioned scrollable area object scripts
</script>
<title>Scrolling</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<script language="Javascript" type="text/javascript">
window.moveTo (0,0)
window.resizeTo(screen.width,screen.height)
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="InitialiseScrollableArea()">
</div> <div id="Layer1" style="position:absolute; width:99px; height:25px; z-index:1; left: 46px; top: 10px; overflow: visible;">
<!-- begin absolutely positioned scrollable area object-->
<div id="divDownControl"> <a href="javascript:;" onMouseOver="PerformScroll(20)" onMouseOut="CeaseScroll()">UP</a>
</div>
<div id="divUpControl"> <a href="javascript:;" onMouseOver="PerformScroll(-20)" onMouseOut="CeaseScroll()">DOWN</a>
</div>
<div id="divContainer" style="overflow: visible; ">
<div id="divContent"><table border="1"><tr><td><b>Scroll Area Content Start</b></p>
<p>Blah dee Blah deeBlah dee Blah dee Blah<br> dee Blah dee Blah dee Blah dee Blah dee Blah dee<br> Blah dee Blah dee Blah dee Blah dee <br> Blah dee Blah dee Blah dee Blah dee Blah<br> dee Blah dee Blah dee Blah dee Blah dee Blah dee Blah<br> dee Blah dee Blah dee Blah dee Blah<br> dee Blah dee Blah dee Blah dee Blah dee <br>Blah dee Blah dee Blah dee Blah dee Blah dee Blah<br> dee Blah dee Blah dee Blah dee<br> Blah dee <img src="http://www.webdeveloper.com/forum/images/webdev-logo2.gif" border=0 alt="">Blah dee Blah dee Blah dee Blah dee Blah<br> dee Blah dee Blah dee Blah dee Blah dee Blah <br> dee Blah dee Blah dee Blah<br> dee Blah dee Blah dee Blah dee Blah dee Blah dee Blah dee <br>Blah dee Blah dee Blah dee Blah dee Blah<br> dee Blah dee Blah dee <br> Blah dee Blah dee Blah dee Blah dee Blah dee Blah dee Blah dee Blah<br> dee Blah dee Blah dee Blah dee Blah dee Blah<br> dee Blah dee Blah dee </p>
<b>Scroll Area Content End</b> </td>
</tr>
</table></div>
</div>
<!-- end absolutely positioned scrollable area object -->
</div>