The Ajax methods in the prototype library have a method specifically for this purpose. You can also give it a shot.
Thanks, Qasim On 6/20/06, Andy Matthews <[EMAIL PROTECTED]> wrote: > > Here's one for you: > http://www.harpethcapital.com/ > > The banner area loads new content every 10 seconds or so using CFAJAX. > Here's the js code. Feel free to grab the CFAJAX files from their if you > like. > ====================================== > > <script type="text/javascript" src="code/engine.js"></script> > <script type="text/javascript" src="code/util.js"></script> > <script type="text/javascript" src="code/settings.js"></script> > <script language="javascript"> > > function loadInfo() { > DWREngine._execute(_cfscriptLocation, null, 'random', > getResult); > } > > function getResult(random) { > document.getElementById("random").innerHTML = random; > } > > function init() { > DWRUtil.useLoadingMessage(); > DWREngine._errorHandler = errorHandler; > loadInfo(); > } > > var timer = window.setInterval("init()", 10000); > > </script> > > Here's the CF code: > <!--- hint="type=keyvalue, jsreturn=array , listdelimiter=| , > delimiter='='" ---> > <cfinclude template="cfajax.cfm"> > > <cffunction name="random"> > > <cfquery name="gettrans"> > SELECT * > FROM tblTransactions > WHERE t_featured=1 > ORDER BY Rand() > LIMIT 1 > </cfquery> > > <cfsavecontent variable="random"> > <cfoutput> > <cfset > path="#Application.BaseDir#www/images/transactions/#gettrans.t_id#.jpg"> > <cfif FileExists(path)><img > src="/images/transactions/#gettrans.t_id#.jpg" > alt="#gettrans.t_title#"><br></cfif> > <strong>#gettrans.t_title#</strong><cfif IsDefined(" > gettrans.t_subtitle") > and gettrans.t_subtitle IS NOT ''><br><span > style="color:##444;">#gettrans.t_subtitle#</span></cfif><br><br> > #gettrans.t_value#<br> > #gettrans.t_trans#<cfif gettrans.t_addmore EQ 1><br> > <a href="javascript:;">view more information</a></cfif> > </cfoutput> > </cfsavecontent> > > <cfreturn random> > </cffunction> > > > > <!----------------//------ > andy matthews > web developer > certified advanced coldfusion programmer > ICGLink, Inc. > [EMAIL PROTECTED] > 615.370.1530 x737 > --------------//---------> > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:244241 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

