Wednesday, September 5, 2007

Move More Than one Div Scroll Bar At a time

This Program describe how to move both the scroll bar of the div at a time using Javascript;
Div Element Temp and Temp1 in this program to make the Div divTop and divBot to get Overflow,
<html>
<head>
<script language="">
function divScroll()
{
var Top = document.getElementById('divTop');
var Bot = document.getElementById('divBot');
Top.scrollLeft = Bot.scrollLeft;
}
</script>
</head>
<body >
Top
<div id='divTop' style="Top:100px; left:0px; width:100px; overflow:auto; overflow-y:hidden; " >
<div id='Temp' style="width:400px;">Test</div></div><br />
Bottom
<div id='divBot' style="width:100px; overflow:auto; overflow-y:hidden;" onscroll="divScroll();">
<div id='Temp1' style="width:400px;">Test1</div></div></body>
</html>

Program Demo

Note IE Supported

No comments: