This page also demonstrates (if you look at it's source) how to take working script and display it as well as optionally execute it without having to duplicate text.