I am hoping someone can help me. I have a javascript function
that does a loop and creates an error message that I want to show
in a "cfwindow". Is there a way to do this as opposed to populating
the window with contents from .cfm page? Here is my code:

a source page of your cfwindow can access all js functions in
the page
that calls' it. thus you can have a cfm/html page as source
and use
document.write in that page to write out the error string
generated by
your js. you will still need a page with js code as source of
your cfwindow.

however...
from usability point of view, displaying form validation, or
other
errors that require use to go back and fix them, in cfwindow
is not much
different from displaying them in a js alert:
both can be annoying and not helping much, since user usually
will need
to close the alert/window to correct the errors, thus loosing
view of
the errors list.

consider instead using same document.write or other method [i
prefer
server-side validation, and maybe ajax-y stuff sometimes for
cool
effects. do not rely only on js for catching/validating
errors - always
validate data on server] to write out errors in the page's
context,
where user can see them while correcting errors to make sure
s/he has
not missed any. if it is a form, consider also applying some
more js to
highlight/mark the fields that generated errors.