Hi all
I have a div elent like this <div id="content" style="width:200px;height:125px;overflow:auto;color:#000000"></div> I fill the div with text dynamically and scroll bars appears. But I want to show tha latest data which fills the div with out scrolling (otherwise the user have to scroll to see the latest data )

I used following function document.getElementById('content').scrollDown=0; It works for some maount of data but after that amount , then it works again normaly and user has to scroll to see latest data
Just give some help to find out why

cheers
nishantha

I m not too sure if i am understanding your question correctly, but if u dont want to see the scrollbars then take out the overflow attribute from the div tag.

When u dynamically get teh data, why dont u get it so the latest will always be the first line in the element.

This is a chat application. so what you type can be able to see without scrolling. So the verticle scroll bar should always be bottom of the div tag

aah i understand now, (stupid me:$ )

try something like this:

<body onload="window.location.hash='bot'">
<div id="content" style="width:200px;height:125px;overflow:auto;color:#000000">
whatever u want to say in it
<a name="bot"></a>
</div>
</body>

I got it working form

var contentV=document.getElementById("content");
contentV.scrollTop = contentV.scrollHeight - contentV.clientHeight;

Thank for the support

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.