I guess it is probably because of the cable line that you're using.
There is problem with the cable line that sometimes it is connected to the computer well and sometimes it is not.....
when it is not connected well to your computer, you won't be able to get to any website
that is one of the possiblities.
other possibilities would be because of your router(if you're using one)
but I think you should check your cable first since you can sometimes connect to the internet (or sometimes partially connected)