A JavaScript library? JavaScript is client-side and accepting bitcoin payments is basically like creating a shopping cart system from scratch. So you're not going to get far with JavaScript alone unless you just want to accept donations by tossing up a QR code. People have tried to generate a thousand addresses on their wallet and then cycle through them using JavaScript (like this), but it's hopelessly insecure and allows for users to possibly pay to the same address.
To create a shopping cart you'll need to use a server-side language like PHP, NodeJS, Python, Perl, etc. The easiest way is using a 3rd party API or you can do everything from scratch with a library. My personal fav is nodejs and bitcore, but this is usually too much for the average user.
If you're looking for something much easier I suggest Mycelium Gear. They basically allow you to fill out a form with your product info and they'll give you a link to post on your site.
Also if you're a wordpress developer I have heard good things about Cryptowoo in conjunction with Woocommerce. I have not tried it myself though.