[thelist] CF: Building a <body> tag.

.jeff jeff at members.evolt.org
Thu Feb 14 21:29:01 CST 2002


frank,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: Frank
>
> > that's one way to do it, but i'd suggest that
> > outputting html in your application.cfm file is
> > sloppy.
>
> Clarification: A document entitled 'TemplateTop.cfm' is
> included in the application file.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

same thing in my mind.

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> > ditto for outputting html with onrequestend.cfm
>
> Ditto for 'TemplateBottom.cfm'
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

ditto what i just said.

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> > well, the answer will depend on how much you need to
> > alter the <body> tag. what exactly do you need to do
> > to it?
>
> Very simply: I set '<body>' by default in my TemplateTop.
> But If I want to add something to it, I  might do
> something like this
>
>    <cf_BodyTag content="onLoad='myJavascript();'">
>
> Where it would prepend the value of 'content' (or
> whatever variable name I might choose) to the closing
> bracket in the tag to create this:
>
>   <body onLoad='myJavascript();'>
>
> The concept is identical to using cfhtmlhead, but instead
> of appending between two head tags, we append within the
> body tag itself.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

ah, so you want complete flexibility.  you can't do it the way you want to
do it.  the problem is that once application.cfm has run the <body> tag has
already been rendered into the output stream.  there's simply no way to go
back and change that.  this brings me back to my original question -- what
exactly are you looking to put in the <body> tag.  if it's javascript event
handlers, you can do that within <script> blocks and don't ever need to mess
with the <body> tag.

<script language="JavaScript" type="text/javascript">
<!--
  function myOnloadEventHandler()
  {
    // do stuff here;
  }

  window.onload = myOnloadEventHandler;
// -->
</script>

good luck,

.jeff

http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/





More information about the thelist mailing list