First of all, if you have speakers that work why not use them instead of the compaq speakers?
As far as your problem is concerned, logic suggests that the problem is not with your computer as other speakers work. If you are getting humming from the compaq speakers then the connection to the audio port is there but the connection itself is faulty. In most cases this is due to overuse of the speaker jack-plug. Repeated pushing in and pulling out weakens the connections inside the plug and they break. In some cases you can (carefully) dismantle the plug and if you are ok with a soldering iron you can repair it. Alternatively you can attach a new audio cable to your speaker (wiring it in to the back of the speaker). Both of these solutions are prone to error, so my advice is to buy some new speakers and refrain from overuse of the jack-plug