I haven't had any problems with CF code between script tags. I do it a lot. Here are
some code samples from the latest pages I wrote. The first one shows how I use a CFIF
to determine what javascript lines to return. The 2nd function shows how I use a CF
variable as a subscript to javascript. I hope these help.
Bill Grover
Supervisor, IS
EU Services, Inc.
649 N Horners Ln
Rockville MD 20850
Phone: 301-424-3300 x396
FAX: 301-424-3300 x1396#
E-Mail: [EMAIL PROTECTED]
WWW: www.euservices.com
------------- File1.cfm -------------
<!---
Page: JobStatus.cfm
Function: Job Status Page
Created by: Bill Grover
This main "page" to display all of the job status information.
--->
<CFINCLUDE TEMPLATE="JavaScript/TabsJava.cfm">
<CFINCLUDE TEMPLATE="JavaScript/FilterJava.cfm">
<CFINCLUDE TEMPLATE="JavaScript/SortJava.cfm">
<CFINCLUDE TEMPLATE="StyleSheets/JobStatStyle.cfm">
<CFOUTPUT>
<HTML>
<HEAD>
<title>#APPLICATION.Title#</title>
</head>
<BODY>
<CFINCLUDE TEMPLATE="JobStatTabs.cfm">
<CFINCLUDE TEMPLATE="FilterTab.cfm">
<CFINCLUDE TEMPLATE="JobStatusTab.cfm">
<CFINCLUDE TEMPLATE="DeptStatusTab.cfm">
</BODY>
</HTML>
</CFOUTPUT>
<CFIF IsDefined("FORM.FilterApplied")>
<SCRIPT LANGUAGE="JavaScript">
TabClick('2', '0');
</SCRIPT>
<CFELSE>
<SCRIPT LANGUAGE="JavaScript">
TabClick('1', '0');
</SCRIPT>
</CFIF>
------------- FilterJava.cfm -------------
<!---
Page: FilterJava.cfm
Function: Filter Click JavaScript Code
Created by: Bill Grover
This file contains the code to control what is displayed when the various
filter radio buttons are clicked.
--->
<CFOUTPUT>
<SCRIPT LANGUAGE="JavaScript">
<!--
function ShowFilters()
{
var nMaxFilters;
var nClickAdjust;
// This is 1 less than the actual number
// Because JavaScript counts from 0
<CFIF APPLICATION.AllJobs EQ "Y">
nMaxFilters = 7;
nClickAdjust = 1;
<CFELSE>
nMaxFilters = 6;
// nClickAdjust = 2;
</CFIF>
for (var i = 0; i <= nMaxFilters; i++)
{
if (FilterForm.Filter[i].checked)
{
FilterClick( "" + (i + nClickAdjust) );
}
}
}
function ValidJob(toForm, toInput, tuValue)
{
var llReturn;
llReturn = true;
if (FilterForm.Filter[#APPLICATION.JobOptionIndex#].checked)
{
lcValue = AllTrim(tuValue)
if (isEmpty(lcValue))
{
llReturn = false;
}
}
return llReturn;
}
-->
</SCRIPT>
</CFOUTPUT>
------------------------------
Date: Thu, 26 Oct 2000 13:15:21 +0100
From: "Paul Johnston" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Subject: RE: Custom Tag w/JS functions
Message-ID: <002001c03f46$699c85a0$162badc0@paul>
bear in mind that no cfcode within <script></script> tags will get
processed.
To get round this, put the code into a page, and then <cfinclude> the code
in between to <script></script> tags:
<script>
<cfinclude template="mytemplate.cfm">
</script>
<script>
<cf_mytemplate>
</script>
Enjoy
Paul
------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebarRsts or send a message with
'unsubscribe' in the body to [EMAIL PROTECTED]