http://www.etcetera.co.uk/Support/howto/howtoConnectGuitar.shtml
This describes it a bit better, your solution should work, although if you have just bought a stock computer and not built it yourself, odds are it'll have a pretty bad soundcard and lose a lot of quality.