Depends. Is is a system window that popped? A browser window? An AV warning? Something else?
If it's a browser window then 99% chance it's a fake message trying to get you to download a "solution" which will be the real virus or trojan. I assume you are running some sort of AV software and keeping that up to date? If not, then don't worry about viruses and trojans as you already have plenty and one more won't hurt. But assuming you take basic steps to keep these things out, force quit the browser (CTRL-ALT-DEL), select the browser and terminate it. Start the browser again, go to a different site, do you still get the warning? If yes, the quit the browser again and run an AV scan. If no then it was a fake alert.
If you already clicked that alert and downloaded something then unplug the computer, put it in a box and use a pen, paper and a telephone instead.