You can think of what will happen as a call tree (time moves from top to bottom):
hanoi(3, ...) =>
|-> hanoi(2, ...) =>
| |-> hanoi(1, ...) =>
| | |-> hanoi(0, ...) =>
| | | \-> (does nothing)
| | |-> document.write(...)
| | |-> hanoi(0, ...) =>
| | | \-> (does nothing)
| | <-/ [hanoi(1, ...) finished]
| |-> document.write(...)
| |-> hanoi(1, ...) =>
| | |-> hanoi(0, ...) =>
| | | \-> (does nothing)
| | |-> document.write(...)
| | |-> hanoi(0, ...) =>
| | | \-> (does nothing)
| | <-/ [hanoi(1, ...) finished]
| <-/ [hanoi(2, ...) finished]
|-> document.write(...) [halfway done!]
|-> hanoi(2, ...) =>
| \-> [same pattern as the first time, with different data]
\-> [hanoi(3, ...) finished]