Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax Colouring in .JS, .INC and other files

Interdev IDE

Syntax Colouring in .JS, .INC and other files

by  MerlinB  Posted    (Edited  )
If you want syntax [color green]colouring[/color] (coloring), pop-up property lists etc. then you need to use the HTML Editor for the source files:

The following solution was provided by Dan_Guest s-)! It works and is very easy...

Do what they say to do here for a .js file (instead of a .htc file that the article is concerned with):

http://support.microsoft.com/support/kb/articles/Q200/8/74.ASP

[ie set the default editor for files with extension .js (or whatever) to HTMLEditor - via the Open With... dialog.]
Then add the line:

//<script language="javascript">

as the first line of your .js file

There you go, you now have colored keywords etc. when you view the source of the .js file. This should also work for other script file extensions such as .vb (where the top line would be:

'<script language="vbscript">

instead)

NOTE: This top line tells the HTML Editor which language to use - but MUST be prefixed with a comment character of that language ([color red]//[/color] or [color red]'[/color]) - else it will error at runtime.

NOTE 2: .js, .vb / .vbs and .inc files will be displayed as plain text in any browser that navigates to that file. To HIDE these files from prying eyes, simply change the file extension to .ASP.

NOTE 3: Include files do not need this top-line comment - as they should already have any language tags in them.
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top