Look up what [man]include/man does. It LOADS the file into the PHP interpreter, i.e. if you had a separate PHP script with functions defined in it.
This is NOT what you're trying to do; you're trying to OUTPUT the contents of a file. This would be accomplished with a function as simple as [man]readfile/man.
EDIT: Upon re-reading your post, I find it a bit odd that the HTML is working and the <script> isn't. I have a theory, but try changing the function to readfile() and see if that works. If not, post a link to the page if you could.