2007-08-09

teyla: Cartoon Ten typing on top of the TARDIS like Snoopy. (Default)
2007-08-09 11:23 pm
Entry tags:

Javascript FTW!

I just found out that you can very easily include sourcecode dynamically into your html documents using the <script language="JavaScript" src="name_of_file.js"></script> command. To do that, you simply put every line of the sourcecode you want to include in brackets, like so:

document.write('Your source code');

You also need to replace any ' you might have in your sourcecode with #&x92;, otherwise, you'll close your document.write brackets too early. Then you save that file as name_of_file.js and put the path to the file into your javascript include in the document where you want to include the sourcecode.

Now, what's so cool about that? )