Sunday, April 17, 2005

Coldfusion Javascript Tip

If you're creating apps that process data and sends the current progress status to the browser so you can keep track of what's going on, you may have encountered the problem with having the hold down the scroll button (arrow/pgdn) so you can keep up with it or the data will just scroll off the page.

Here's a little javascript block that you can send with your progress status that'll scroll the browser for you.

Here's an example where it processes a data file line by line

<CFSET JS="<script language=""Javascript"">window.scroll(0,999999999);</script>">

<CFLOOP index="loop" from="1" to="#ListLen(DataFile,Chr(10)#">
<CFSET CurrLine=ListGetAt(DataFile,loop,Chr(10))>
<CFOUTPUT>Processing line #loop#<br>#JS#</CFOUTPUT>
<CFFLUSH>

<!--- Random bits of code here --->

</CFLOOP>

0 Comments:

Post a Comment

<< Home