Scroll window after new line added dynamically

I have a mail script that sends out newsletters.  It's written in ASP VBScript.

The mail script is located inside a do while loop and sends out 1 email at a time (at remote smtp server's request).

Here's what's going on.

===========================================
Create recordset.

  while not rs.eof
  response.Write "Sending email to " & rs.EmailAddress>
  <<email script goes here>>
  response.Write " - OK"
Insert text on page > " - OK <BR>"

rs.movenext
wend
===========================================

The script works fine, but it's the visuals my client is not happy with.

Every time an email is about to be sent, the text "Sending email to bob@domain.com" is displayed, and when it's sent, the text " - OK" is added to the same line and then a line break.

After about 30 or so emails are sent, the new lines that are added disappear below the scroll line and the user has to manually scroll the page to see where they are at.

He wants the page to scroll every time a new email is sent so the last email address is always visible on the page.

Is there a way (maybe using javascript) that can be added before the "rs.movenext" line in the script that would scroll the page to the bottom of the window?

I thought about adding an element under the script and setting the focus to that point, but I can't figure out how to do that inside the ASP script.

Thanks
Nico

LVL 1
webmasterbizAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bluV11tCommented:
Hi!
Try this:

(I couldn't get it to stop scrolling automatically tho)
    <head>
   <script language="javascript">
   var scrolldelay;
 
   function pageScroll() {
    	window.scrollBy(0,50); // horizontal and vertical scroll increments
    	scrolldelay = setTimeout('pageScroll()',100); // scrolls every 100 milliseconds
    }
      function stopScroll() {
    	    clearTimeout(scrolldelay);
    }
 
   </script>
   </head>
   
   <body onload="pageScroll();">
 
//Then below the OK lines:
    <a id="stopIt" href="Javascript:stopScroll();">Stop scrolling</a>

Open in new window

0
webmasterbizAuthor Commented:
Hi bluV11t

Do you think there's a way to simply call the pageScroll(); function from within the ASP script (just before rs.movenext) , so that it steps down every time a new line is added to the page?
0
bluV11tCommented:
Hi!
If you response.flush() to the browser f.ex. before each rs.movenext I think this could be achieved but it still needs to be javascript and clientside.

F.ex:
response.Write " - OK<script language="javascript">window.scrollBy(0,50);</script>"

You don't need any of the previous scripts for this to work.

On response.flush() take a look at this:
http://www.devx.com/vb2themax/Tip/18404
Quote: Note, however, that you must take special precautions when your output is an HTML table, because many browsers won't render the table until the closing </TABLE> is received.


0
bluV11tCommented:
Sorry, some missing quotation-marks

response.Write " - OK<script language=""javascript"">window.scrollBy(0,50);</script>"
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
webmasterbizAuthor Commented:
Thanks mate.
That's exactly what I wanted.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.