?
Solved

Scroll window after new line added dynamically

Posted on 2008-11-06
5
Medium Priority
?
296 Views
Last Modified: 2012-05-05
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
Comment
Question by:webmasterbiz
  • 3
  • 2
5 Comments
 
LVL 7

Expert Comment

by:bluV11t
ID: 22893765
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
 
LVL 1

Author Comment

by:webmasterbiz
ID: 22893823
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
 
LVL 7

Expert Comment

by:bluV11t
ID: 22894413
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
 
LVL 7

Accepted Solution

by:
bluV11t earned 1200 total points
ID: 22894431
Sorry, some missing quotation-marks

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

Author Closing Comment

by:webmasterbiz
ID: 31513815
Thanks mate.
That's exactly what I wanted.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month16 days, 3 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question