How to Program Two List Boxes to Scroll Together?
Thank you for the help.
Thank you for the help.
overflow:scroll style (taken directly out of the link I posted in my last reply):<html>
<head>
<style type="text/css">
div.scroll
{
height:100px;
width:100px;
overflow:scroll;
}
</style>
</head>
<body>
<div class="scroll">
You can use the overflow property when
you want to have better control of the layout.
The default value is visible.
</div>
</body>
<html>
<head></head>
<body>
<div style="height:100px; height:width; overflow:scroll;">
You can use the overflow property when
you want to have better control of the layout.
The default value is visible.
</div>
</body>
<asp:Panel style="height:100px; width:100; overflow:scroll;">
You can use the overflow property when
you want to have better control of the layout.
The default value is visible.
</asp:Panel>
<!--
You would have to have the following CSS style
defined somewhere accessible to the page:
<style type="text/css">
div.scroll
{
height:100px;
width:100px;
overflow:scroll;
}
</style>-->
<asp:Panel CssClass="scroll">
You can use the overflow property when
you want to have better control of the layout.
The default value is visible.
</asp:Panel>
onscroll event for the div/Panel. In that method you should use the scrollTop and scrollLeft properties of the controlling div to change the scroll position in the other div/panel.<html>
<head>
<script type="text/javascript">
function scrollDiv(controllingElement, controlledElementID)
{
var controlledElement = document.getElementById(controlledElementID);
controlledElement.scrollTop = controllingElement.scrollTop;
controlledElement.scrollLeft = controllingElement.scrollLeft;
}
</script>
</head>
<body>
<div id="div1" onscroll="scrollDiv(this,'div2');" style="overflow:scroll; height:100; width:70; border:solid 1px blue; float:left; margin:10;">
I am demonstrating how to scroll two
sections of the page with one scroll bar...
In here you should place your ListBox instead of text.
Scroll more to show more text.
This is a lot of text that needs to be scrolled for
demonstration purposes.
</div>
<div id="div2" onscroll="scrollDiv(this,'div1');" style="overflow:scroll; height:100; width:70; float:left; border:solid 1px green; margin:10;">
I am demonstrating how to scroll two
sections of the page with one scroll bar...
In here you should place your ListBox instead of text.
Scroll more to show more text.
This is a lot of text that needs to be scrolled for
demonstration purposes.
</div>
<p style="clear:both">
You could set one of these div's to have an
overflow style of hidden if you want to.</p>
</body>
</html>
Comment