August 9th, 2007

Javascript FTW!

  • Aug. 9th, 2007 at 11:23 PM
teyla: Cartoon Ten typing on top of the TARDIS like Snoopy. (Default)
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? )

Tags:

Latest Month

February 2024
S M T W T F S
    123
45678910
11121314151617
18192021222324
2526272829  

Tags

Powered by Dreamwidth Studios
Designed by [personal profile] chasethestars