Ali, what you got was a "pop up" advertisement. You need a pop up stopper. You are probably using that absolutely worthless Internet Explorer browser.
If you absolutely, positively just have to have it, go to
MyIE2.com, and apply this add-on. It really helps and if I recall, has a pop-up stopper.
However, if you are interested in nothing but the best, go to
Opera.com, and get the fastest and best browser on the planet. It is not free, but if you use the internet a lot, it is more than worth it. I'm cheap, and I use it.