PDA

View Full Version : A DIV area critical situation



npsari
05-12-2007, 09:18 PM
Hi

I have a Normal Div area
It contains Text inside it

<div style="width:300px;height:300px;overflow:auto;border-width:0px;border-color:000000;border-style:solid;">
Text is here
Text is here
Text is here
</div>

I want when the page is loaded, this div area shows the bottom automatically
i.e. The last Line

I dont want users to scroll down this little div area everytime page is loaded

Do you know how this can be done?

jscheuer1
05-12-2007, 10:55 PM
Your example division will have no scrollbars. However, given enough content, it would and the default scroll position would be 0 or at the top. To scroll it using javascript, use the scrollTop property:


<div id="myDiv" style="width:300px;height:300px;overflow:auto;border-width:0px;border-color:#000000;border-style:solid;">
Text is here
Text is here
Text is here
</div>
<script type="text/javascript">
onload=function(){setTimeout("document.getElementById('myDiv').scrollTop=30000",100);};
</script>


No point in having a border with border-width:0px; but, if you do, you need the hash mark before the color number:

#000000

not:

000000

npsari
05-13-2007, 11:11 AM
Thanks
it works perfect