In addition to another solution to this problem mentioning the usage of various ad blocking software in the form of browser plug-ins, I would recommend a different approach:
Block Flash-elements. Flash is a shitty format mostly used by advertisers. Blocking it helped me not only against advertisements, but also with increasing the battery life of my computer.
An appropriate software for this would be Clicktoflash (http://clicktoflash.com) - it has the advantage of still offering you the blocked flash-applet if you want to see it, as it might be the case with designerly websites or stream video players. There are similar programs for other browsers.