I'm sorry for the name of a topic that is not descriptive enough, but I couldn't find a short descriptive title.

I have two almost identical pages. Actually I don't know how to describe my problem...
The problem has something to do with document.write. It doesn't work as I thought it would.

It's best that you check out both examples and go through source code because I have written comments to specify my problem.

test #1
test #2

The first example works like a charm but the second one doesn't.

What I want is a page made entirely with document.write().