473,765 Members | 2,172 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="addtex t('Wed Mar 23 11:23:58 AM Eastern Standard Time
2005<BR>');">
<b>HELLO</b>
</a>
<div id=MyDiv style=height:20 0;overflow:auto class=normal style="border:1 px
CCCCCC solid">
</div>
<script>

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

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

addtext('111159 5039<BR>');
addtext('111159 5040<BR>');
addtext('111159 5041<BR>');
addtext('111159 5042<BR>');
addtext('111159 5043<BR>');
addtext('111159 5044<BR>');
addtext('111159 5045<BR>');
addtext('111159 5046<BR>');
addtext('111159 5047<BR>');
addtext('111159 5048<BR>');
addtext('111159 5049<BR>');
addtext('111159 5050<BR>');
addtext('111159 5051<BR>');
addtext('111159 5052<BR>');
addtext('111159 5053<BR>');
addtext('111159 5054<BR>');
// End hiding -->
</script>
Jul 23 '05 #1
3 1136
In article <42********@use net01.boi.hp.co m>, 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="addtex t('Wed Mar 23 11:23:58 AM Eastern Standard Time 2005
<BR>');">
<b>HELLO</b>
</a>
<div id="MyDiv" style="width:40 0px;height:100p x;overflow:scro ll;border:1px
CCCCCC solid">
</div>
<script type="text/javascript">
function addtext(string)
{
var c = new Date();
oDiv = document.getEle mentById("MyDiv ");
oDiv.innerHTML = oDiv.innerHTML + string;
oDiv.scrollTop = oDiv.scrollHeig ht;
}

addtext('111159 5039<BR>');
addtext('111159 5040<BR>');
addtext('111159 5041<BR>');
addtext('111159 5042<BR>');
addtext('111159 5043<BR>');
addtext('111159 5044<BR>');
addtext('111159 5045<BR>');
addtext('111159 5046<BR>');
addtext('111159 5047<BR>');
addtext('111159 5048<BR>');
addtext('111159 5049<BR>');
addtext('111159 5050<BR>');
addtext('111159 5051<BR>');
addtext('111159 5052<BR>');
addtext('111159 5053<BR>');
addtext('111159 5054<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********@use net01.boi.hp.co m>, 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="addtex t('Wed Mar 23 11:23:58 AM Eastern Standard Time 2005
<BR>');">
<b>HELLO</b>
</a>
<div id="MyDiv" style="width:40 0px;height:100p x;overflow:scro ll;border:1px
CCCCCC solid">
</div>
<script type="text/javascript">
function addtext(string)
{
var c = new Date();
oDiv = document.getEle mentById("MyDiv ");
oDiv.innerHTML = oDiv.innerHTML + string;
oDiv.scrollTop = oDiv.scrollHeig ht;
}


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**********@t itan.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
3610
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 trying to explain it I wrote some small C# code to demonstrate the fact that in the threaded version the textbox simple doesn't scroll like it should… please look to the startButton_Click method for the distinction between the two programs..
0
2245
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 rich textbox to the tab sheet. The rich textbox is placed at 0,0 (upper left corner) within the tab sheet and is initially 1 "line" tall to accomodate the user's first line of text. The rich text box is, in actuality, a user control of mine...
6
1550
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 the display of the table. the top left corner in the table grid is hidden from being displayed. I have tried to figure out where it is being hidden but can't find the code to allow it to be shown as part of the left frozen column. can anyone...
0
1012
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 (CreateGraphics, Nothing) If e.KeyCode = System.Windows.Forms.Keys.Left Then For XOffSet = 1 To 40 Step 1 ' Simulate scrolling. InvokePaint(Me, PaintEventArgument)
3
2719
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 second DataGrid's DataSource. All that works very well. And, when there are no records to display, it is simply left blank. My issue is that when i scroll the first one, sometimes the second grid shows a bunch of null values (a "new" record). ...
1
1849
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 autoscroll = true to handle scrolling automatically. but when i drag the components of form, scrolling occurs extra ordinary too fast.. so plz help me to control scrolling as in visual studion designer.. as we
11
7654
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 characters into the display myself - but that's not the main issue at this time. I've tried a scrolling multiline text box but once the original viewable area fills up and it starts scrolling the flashing of the entire area drives me nuts. The...
2
1461
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 set <iframe Scrolling=No> the contents at the end are not accessible,else the site has mulitiple scroll bars. Please help.
0
9398
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10156
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9951
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9832
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8831
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5419
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2805
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.