I'm sorry to say it, but research has shown that modern technology... like the internet... has reduced our attention spans and made it more difficult for us to focus. I don't think there's a quick fix, but I do know that the less time I spend online, the better able I am to stick to one task and give it my full attention.
I'm not saying give up the internet completely, but maybe set aside a certain amount of time per day and stick to it? I also try to unplug at least one day a week. I don't go online at all unless it's necessary for work.