Hello people, Do you know how can I actually call a Coldfusion funsction with a javascript function.
for example I am using onClick to call a cffunction inside a div. (DOM) Example: <!-- <body> <cffunction name="MyExample" output="yes" returntype="string"> <cfreturn "My DOM Coldfusion Example"> </cffunction> <br /> <a href="#"onClick='document.getElementById("contentMain").innerHTML = "#MyExample()#";'>example</a></li> <div id="contentMain"> </div> </body> YOU CAN NOT DO THIS. Sorry about the wasted three hours! But as a newbie here is a mantra to learn. ColdFusion is SERVER SIDE and JavaScript is CLIENT SIDE and never the TWAIN SHALL MEET! Now Ajax and some other technologies blur this distinction, but in the gritty details this is more of a matter of perception rather then how it really works. What would happen in your example is that CF would run your function, put the results into the response and send the already completed anchor tag to the client, before the client even knows there is javascript to run. Then the client gets it's turn to run the javascript on the rendered response in the browser, but it has no knowledge of the CFML that was used to create this response. Depending on what you are really trying to do, there are some very powerful techniques for blending CF and JavaScript. Starting with using CFML to create dynamic JS, unique to each response request by different users; and going all the way up to using AJAX to call ColdFusion code asynchronously and having the results returned to the originating request without generating an entirely new request in the browser. -------------- Ian Skinner Web Programmer BloodSource www.BloodSource.org Sacramento, CA --------- | 1 | | --------- Binary Soduko | | | --------- "C code. C code run. Run code run. Please!" - Cynthia Dunning Confidentiality Notice: This message including any attachments is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender and delete any copies of this message. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Create robust enterprise, web RIAs. Upgrade & integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:265158 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4