> -----Original Message-----
> From: Scott Stewart [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, May 23, 2007 9:49 AM
> To: CF-Community
> Subject: javascript question
> 
> Hey guys,
> 
> 
> 
> When using "innerHTML" can you call a template? Or is this just for
> chunks
> of text.

You can do what you want, but it's not a simple "one call".

Essentially to load an element with some "remote" content you first have to
call it then pump it into the innerHTML.  Most libraries will help with
this.  I've got two components that, together, make it easy.

The first is a Request Pooler that simplifies AJAX-style requests:

http://www.depressedpress.com/Content/Development/JavaScript/Extensions/DP_R
equestPool/Index.cfm

The second is a "panel manager".  One feature of it is an advanced "load"
method that will also load and enable any script that's found in the
content.

http://www.depressedpress.com/Content/Development/JavaScript/Extensions/DP_P
anelManager/Index.cfm

If you're not going to ever load any script into the div then you can ignore
the panel manager and just use innerHTML as you always would.

I've appended a simple example of how this would work.  I know it looks
complicated, but it really makes sense when you walk through it.  Let me
know if you want me to dig deeper into anything.

Jim Davis


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd";>
<html>
        <head>
                <meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
                <title>Test</title>
                <script type="text/javascript"
src="DP_RequestPool.js"></script>
                <script type="text/javascript"
src="DP_PanelManager.js"></script>
                <script type="text/javascript">

                                // Create a Panel Manager
                        Panels = new DP_PanelManager();
                                // Make a panel out of the div
                        Panels.addPanel("PhoneyFrame");

                                // Create a new RequestPool     and start
its queue
                        RequestPool = new DP_RequestPool(1);
                        RequestPool.startInterval(100);
                                // Create a Request to get the Family data
                                // This makes the initial request for the
data and sets the handler, "LoadData", that will deal with it
                                // You could obviously create a function to
accept the file as input and do the same thing. 
                        myRequest = new DP_Request(
                                "get",
                                "yourfile.htm",
                                null,
                                LoadData);
                                // Add the request to the queue
                        RequestPool.addRequest(myRequest);

                                // Load the data
                        function LoadData(NewContent) {
        
document.getElementById("PhoneyFrame").load(NewContent);
                        };


                </script>
        </head>
        <body>
                <div id="PhoneyFrame"></div>
        </body>
</html>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create Web Applications With ColdFusion MX7 & Flex 2. 
Build powerful, scalable RIAs. Free Trial
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS 

Archive: 
http://www.houseoffusion.com/groups/CF-Community/message.cfm/messageid:235409
Subscription: http://www.houseoffusion.com/groups/CF-Community/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.5

Reply via email to