You can configure the HOSTS file to prevent the browser from connecting to those malicious sites. Check the following link, which is about how to block those irritating ads from some notorious sites, to get some more details.
http://www.ecst.csuchico.edu/~atman/spam/adblock.shtml