CSS is the best way to handle this for viewing purposes. But if you want people to be able to copy/paste the text and get four spaces for a tab, then you're going to end up using Javascript to modify your pre tags.
All Tabs Changed a little.
The real magic here is the replace() function, using a globally-matched regex.