• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 299
  • Last Modified:

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

0
webmasterbiz
Asked:
webmasterbiz
  • 3
  • 2
1 Solution
 
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
 
webmasterbizAuthor Commented:
Thanks mate.
That's exactly what I wanted.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now