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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

including Javascript in Interdev 1

Status
Not open for further replies.

dokken

Programmer
Mar 7, 2001
61
US
I want to have seperated Javascript file that I include in my html pages. How do I include a .js file in my VI project so the IDE will recognize it as javascript and give me the autocomplete on JS objects?
 
Try storing the javascript in a .ASP (or .HTM) file with the <SCRIPT LANGUAGE=JavaScript> ... </SCRIPT> tags.
Include this file as..
<!--#include file=&quot;yourJScriptFilePath.asp&quot;-->
 
That is what I ended up doing. Does the <!--#include file=&quot; work with html also?
 
The #include is a pre-processor directive which can be located in ASP or HTML pages, as well as some other pages - check the documentation for other page types.

The included file can be ANY file, with ANY extension - except that the contents are added to the current page (ASP or HTML) and the net result should be syntactically correct.

However, by using the .ASP extension, visitors cannot purposly view the contents of the include file (unless they get an FTP connection, of course).
 
s-)

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


Then add the line:

//<script language=&quot;javascript&quot;>

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top