I'm a new CF user and can't figure out how to reference CF Variables from a JavaScript function. The CF Variables are set on the same page as the JavaScript function is coded. The example below is the simplified version of my problem - simple as it is, I can't seem to solve it.
I found the following method posted on the web, but it doesn't work for me:
<CFSET first_year_int = 1993>
<CFSET first_year_int = 1993>
<SCRIPT language="JavaScript">
function Calendar(month, year) {
var first_year_JSint = #first_year_CFint#;
var last_year_JSint = #last_year_CFint#;
for (year=first_year_JSint; year<(last_year_JSint + 1); year++){
.....output...
}
The output works fine when the variable names within the JS function are replaces with values. I've played with al sorts of syntax here, but can't get JavaScript to recognize my CF variables.
Any help would be appreciated!
I found the following method posted on the web, but it doesn't work for me:
<CFSET first_year_int = 1993>
<CFSET first_year_int = 1993>
<SCRIPT language="JavaScript">
function Calendar(month, year) {
var first_year_JSint = #first_year_CFint#;
var last_year_JSint = #last_year_CFint#;
for (year=first_year_JSint; year<(last_year_JSint + 1); year++){
.....output...
}
The output works fine when the variable names within the JS function are replaces with values. I've played with al sorts of syntax here, but can't get JavaScript to recognize my CF variables.
Any help would be appreciated!