Use the Faux Column CSS technique to solve this problem.
Using JavaScript to solve this problem is the equivalent of using a jackhammer to nail a wooden plank to a floor. If your plank is not solid enough (JavaScript is disabled or the browser has a poor implementation), than it breaks (and so does your solution).
Personally I feel that having the JavaScript solution marked as accepted sends the wrong message to people who will stumble upon this page and think it is the best solution to their problem.
The fact that you have multiple sidebars doesn't stop you from using this solution. Given the following:
<div class="contentSidebarPair">
<div class="sidebar"></div>
<div class="content"></div>
</div>
You can use the following styles:
/* sidebar.gif is simply a 200x1px image with the bgcolor of your sidebar.
#FFF is the bgcolor of your content */
div.contentSidebarPair {
background: #FFF url('sidebar.gif') repeat-y top left;
width: 800px;
zoom: 1; /* For IE */
}
/* IE6 will not parse this but it doesn't need to */
div.contentSidebarPair:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
div.sidebar {
float: left;
width: 200px;
}
div.content {
float: left;
width: 600px;
}
There! Simple and effective. Absolutely zero JavaScript involved. And if you want to create more complex layouts (liquid layouts), you can adapt this technique using background-position. A tutorial is available here.