The script below does what I'm looking for. It finds the first instance of
the current date on the active page, scrolls it into view, and selects it.
However, I'm trying to get the date to be scrolled to the top of the page.
From what I read on MSDN about scrollIntoView, this is supposed to be the
default behavior of the command. However, it only seems to work if the date
is found above what is currently showing on the screen. If the date is
found below whats currently on the screen then the scrollIntoView seems to
default to scrollIntoView(false) with no way to change it (meaning the
object being scrolled to is always at the bottom of the screen). Is there a
workaround that can force it to the top?

By the way, I'm using this to quickly scroll to new posts in a forum I
frequent.

Thanks!

-Jeremy

---------------------------------------------------------------------------
<script language="vbscript">
Dim sDate, oRange

sDate = Right("0" & Day(Date),2) & "-" & Right("0" & Month(Date),2) _
& "-" & Year(Date)
Set oRange = document.body.createTextRange
With oRange
.findText(sDate)
.scrollIntoView(true)
.select
End With

</script>
---------------------------------------------------------------------------

Re: scrollIntoView not bringing object to top of screen by Bob

Bob
Tue Dec 02 06:09:02 CST 2003

Jeremy Gollehon wrote:
> The script below does what I'm looking for. It finds the first

No need to start a new thread. I've already posted an answer in the original
thread.

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"