473,406 Members | 2,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

scrolling issue. pleeeezzzz help...

Mel
i have the following code and need to scroll the div to the bottom on each
of the inserts.

please help *&^%$#@

<a href=# onclick="addtext('Wed Mar 23 11:23:58 AM Eastern Standard Time
2005<BR>');">
<b>HELLO</b>
</a>
<div id=MyDiv style=height:200;overflow:auto class=normal style="border:1px
CCCCCC solid">
</div>
<script>

<!--- Hide script from browsers that don't understand JavaScript

function addtext(string) {
var c = new Date();
oDiv = document.getElementById("MyDiv");
oDiv.innerHTML = oDiv.innerHTML + string;
self.scroll(0, 50000);
}

addtext('1111595039<BR>');
addtext('1111595040<BR>');
addtext('1111595041<BR>');
addtext('1111595042<BR>');
addtext('1111595043<BR>');
addtext('1111595044<BR>');
addtext('1111595045<BR>');
addtext('1111595046<BR>');
addtext('1111595047<BR>');
addtext('1111595048<BR>');
addtext('1111595049<BR>');
addtext('1111595050<BR>');
addtext('1111595051<BR>');
addtext('1111595052<BR>');
addtext('1111595053<BR>');
addtext('1111595054<BR>');
// End hiding -->
</script>
Jul 23 '05 #1
3 1119
In article <42********@usenet01.boi.hp.com>, me**********@hp.com enlightened
us with...
i have the following code and need to scroll the div to the bottom on each
of the inserts.

please help *&^%$#@


Tested in MSIE6 and Firefox 1.0

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
</head>

<body>
<a href=# onclick="addtext('Wed Mar 23 11:23:58 AM Eastern Standard Time 2005
<BR>');">
<b>HELLO</b>
</a>
<div id="MyDiv" style="width:400px;height:100px;overflow:scroll;bo rder:1px
CCCCCC solid">
</div>
<script type="text/javascript">
function addtext(string)
{
var c = new Date();
oDiv = document.getElementById("MyDiv");
oDiv.innerHTML = oDiv.innerHTML + string;
oDiv.scrollTop = oDiv.scrollHeight;
}

addtext('1111595039<BR>');
addtext('1111595040<BR>');
addtext('1111595041<BR>');
addtext('1111595042<BR>');
addtext('1111595043<BR>');
addtext('1111595044<BR>');
addtext('1111595045<BR>');
addtext('1111595046<BR>');
addtext('1111595047<BR>');
addtext('1111595048<BR>');
addtext('1111595049<BR>');
addtext('1111595050<BR>');
addtext('1111595051<BR>');
addtext('1111595052<BR>');
addtext('1111595053<BR>');
addtext('1111595054<BR>');
// End hiding -->
</script>

</body>
</html>

--
--
~kaeli~
A chicken crossing the road is poultry in motion.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #2
kaeli wrote:
In article <42********@usenet01.boi.hp.com>, me**********@hp.com enlightened
us with...
i have the following code and need to scroll the div to the bottom on each
of the inserts.

please help *&^%$#@

Tested in MSIE6 and Firefox 1.0

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
</head>

<body>
<a href=# onclick="addtext('Wed Mar 23 11:23:58 AM Eastern Standard Time 2005
<BR>');">
<b>HELLO</b>
</a>
<div id="MyDiv" style="width:400px;height:100px;overflow:scroll;bo rder:1px
CCCCCC solid">
</div>
<script type="text/javascript">
function addtext(string)
{
var c = new Date();
oDiv = document.getElementById("MyDiv");
oDiv.innerHTML = oDiv.innerHTML + string;
oDiv.scrollTop = oDiv.scrollHeight;
}


Now the challenge is to only scroll to the bottom if the div is already
at the bottom when the new text is added.

Ie, if the user has used the mouse to look back at the history, the div
just grows without changing the scrolling position.

A nice feature which I've tried in the past and never got exactly right!

Jul 23 '05 #3
In article <d2**********@titan.btinternet.com>, no***@noway.com enlightened
us with...

Now the challenge is to only scroll to the bottom if the div is already
at the bottom when the new text is added.

Ie, if the user has used the mouse to look back at the history, the div
just grows without changing the scrolling position.

A nice feature which I've tried in the past and never got exactly right!


I think for that you'd have to use clipping, similar to the scroller in the
link below, since you'd need to know the current position of things, when
things were changed by the user, and where the bottom is (that's the most
important part and I couldn't find a way to get whether something was at the
bottom without using this method).
More complicated, but quite possible.

http://www.quirksmode.org/js/layerscroll.html
--
--
~kaeli~
If God dropped acid, would he see people?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Wesman | last post by:
Threads, textboxes and scrolling Thanks in advance for any information on this matter. I have run into a small richtextbox, scrolling and tread issue. Which has me totally confused. Instead of...
0
by: 23s | last post by:
Is there any way I can send a vertical value to a form's scroll position? I have a full-screen form that, at launch, contains an empty tab sheet. At run time, the user can dynamically append a...
6
by: Jon Paal | last post by:
an excellent working solution for scrolling tables appears at this link http://www.litotes.demon.co.uk/example_scripts/tableScroll.html author has no contact page, but I have a question about...
0
by: The Confessor | last post by:
I've narrowed down my problem, but I've yet to find a solution, so here goes again: Private Sub Form_Main_KeyDown() Handles MyBase.KeyDown Dim PaintEventArgument As New PaintEventArgs...
3
by: Brian Tkatch | last post by:
I have a form with two DataGrids, which are kept in sync manually via Stored PROCEDURE calls. That is, when a record is selected on the first grid, a stored PROCEDURE is CALLed to Fill() the next...
1
by: atif | last post by:
Hi, I m new to CSharp.. so may be my preliminary questions look stupid.. but plz help me.. I want to drag controls like buttons or some other user controls over form.. i have set form's...
11
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
Hello, I know I sound like a one-note Johnny on this but I'm still looking for a solution. I need to display characters coming in from a serial port or a socket. I also need to be able to type...
2
by: ProgrammerMS | last post by:
I am working on a internal website, The site has tabs, these tabs are built using iframes. The issue I have is that is there a way to display contents in the iframe without using the scrollbar. If i...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.