I had the same idea of the function being called before the DOM was loaded, so I tried moving the js to the head as opposed to the end of the body to see if that mattered...didn't help.
I think something is going on with Firefox when trying to get it to include some of the js files. First, updates weren't appearing quickly when edited files were FTP'd to the server and then I noticed that some of the files weren't even listed in Firefox when I attempted to make sure they were being read when viewing the "Script" tab. I had to restart Firefox and sometimes make minor changes like adding a space to get a file to be read by the browser. I guarantee you it's not the first time I've had "quirkiness" when working with a lot of js, ajax, and cf together. Thanks for the feedback! Rick -----Original Message----- From: Michael Grant [mailto:mgr...@modus.bz] Sent: Wednesday, October 27, 2010 7:52 PM To: cf-talk Subject: Re: Question about using javascript in .cfm files... Yeah, to the browser they are identical. Is it possible that you are calling your function before it's been added to the document? Like you don't call checkUserFavorites above your <script> tag do you? What does firebug or chrome tools show you as the content of the file? If your page is being rendered while suppress whitespace (cfsilent, enablecfoutputonly, etc) you may need to wrap your js producing code in <cfoutput>. On Wed, Oct 27, 2010 at 1:44 PM, Rick Faircloth <r...@whitestonemedia.com>wrote: > > I've been using js files as .cfm files > so I can intermix cf variables in the js. > > i.e., naming myJSFile.js, "myJSFile.js.cfm", instead. > > This seems to work fine, but I've run into an issue > that makes me wonder if this works in all cases as > a regular js file would. > > Here's the question: > > If I have a js function in a .cfm file, would the > declared function be defined by the browser > upon first entering a page as it would if the function > were in a .js file? > > e.g., should the function "checkUserFavorites": > > function checkUserFavorites(USERID) { > > blah, blah, blah > > be defined if the js were in a .cfm file as readily > as it would in a .js file? > > I keep running into a "checkUserFavorites is not defined" > for which I cannot track down the problem. > > I'm reaching for an answer at this point, because I can't > otherwise explain the error message otherwise, yet. > > Thanks for any feedback. > > Rick > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338635 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm