Hmmm. You presumably mean you can only get on the internet when connected by wire to the router -- or directly to a cable modem. So problem is perhaps with wireless between computer and router.
We shouldn't have to guess, should we ? So if I'm wrong could you enlarge on your post a little ?
Meanwhile, consider this:
Optimise your reception and avoid interference.
1) raise the router above furniture level
2) Experiment with channels (some will work better or worse depending on your environment)
3) If you can detect strong neighbouring wifi, use a channel 5 stops away from strongest.
4) Relocate cordless phone base or video sender etc.
5) Be prepared to move the computer (or at least turn it so your body is not between the router signal and the wireless adapter's antenna.