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="yourJScriptFilePath.asp"-->
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).
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
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.