Whoooaa :) overkill.. but similar to what I would have responded..
>Don't change your .js files to .cfm files or mess with your server
>extensions or <cfinclude> them. That's not how the browser uses the .js
>files.
>
>If you want to include CF variables in your .js files, do this.
>
>In a separate WriteJSOutput.cfm file, process the CF variables, and then
use
>CFFILE to write to your .js file.
This answer rocks!!! :)
> Why not leave the file as a .cfm file but put <CFCONTENT
> TYPE="application/x-javascript"> at the top?
>
> Keith C. Ivey <[EMAIL PROTECTED]>
> Webmaster, EEI Communications
> 66 Canal Center Plaza, Suite 200
> Alexandria, VA 22314
> Telephone: 703-683-0683
> Fax: 703-683-4915
> Web Site: http://www.eeicommunications.com
Anyway, for my mediocre answer:
I set any CF->javascript variables BEFORE the javascript file reference is
made in the result HTML.
Set them as normal javascript variables, which are globally scoped to the
page.
eg.
----
cfset CFMjscriptVarforExample = 'I will be passed to a .js file which can
manipulate me'
cfoutput
script
var jscriptVarforExample = #CFMjscriptVarforExample#
/script
script src="/javascript/jsFileWhichExpects_jscriptVarforExample.js"
/script
/cfoutput
----
Jared Clinton.
Maxi Multimedia.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists