$(document).ready(function(){ var scrollbarWidth = $('#main')[0].offsetWidth - $('#main')[0].scrollWidth; alert('滚动条的宽度是:' + scrollbarWidth + 'px');
});